Welcome to Geeklog, Anonymous Tuesday, January 31 2023 @ 04:10 pm EST

Geeklog Forums

Simple Upload


Status: offline

squatty

Forum User
Full Member
Registered: 01/21/02
Posts: 269
I found this nifty little upload class that I thought might be worth sharing. The class allows you to specify what sort of files to accept (by mime type), the max file size, and includes a method for addressing duplicate files.

After some tweaking, I managed to get the class to play nice with Geeklog. You can see the class in action here.

In addition, I've packaged up a scaled down version of the example in the above link and placed it in my downloads section. You can get the code here.


In a world without walls and fences, who needs Windows and Gates?
 Quote

Status: offline

squatty

Forum User
Full Member
Registered: 01/21/02
Posts: 269
I added a bit of code to the "upload" form that will send an email to a specified user in the event of a new upload. I guess you could call it "upload notification" :-)
In a world without walls and fences, who needs Windows and Gates?
 Quote

foniksonik

Anonymous
I added this to my site and it works quite nicely. I also added a symlink to the uploads directory ala ../fileupload/uploads ==> files in public_html so people can just add a link like so <a href="files/[file_name_here]>file</a> to any article or comment. I did comment out the e-mail notice code addition as it seems to slow down the script and makes it seem like the upload is taking longer than it is. My site is for employees only so i'm not overly concerned about notification of uploads though. I'm curious as to whether you integrated this with the file download script you posted previously. Last but not least, is the GL code in your version of upload.php enough to integrate this into the auth system for GL or is it just enough to get it to work? I'll look into it myself but if you have a quick take on how much of an issue this could be i'd appreciate it. Mostly because there are plenty of file browsers available for php that could be integrated for use as a file manager and if all I have to do is add the include for GL libs and some begin content block/end content block code it sounds fairly easy to do a file system type file manager. Thanks for the reference and thanks in advance for any further enlightenment.
 Quote

Status: offline

squatty

Forum User
Full Member
Registered: 01/21/02
Posts: 269
Like the symlink idea! As for the integration, no I did not add the upload script to the download tool (paFileDCool. That too would have been a nice addition. I simply added a link in the downloads section to the upload form….quick hack. For the most part, my intent on posting this story was to provide a quick utility (class) for uploading files. The GL integration was an after thought. As you have come to notice, it is quite easy to "wrap" any bit of code within Geeklog. You simply need to make the appropriate calls to site header/footer and block start/end. The one gotcha with this is that not all code plays nicely with Geeklog and programs that have built-in security/authentication will need some work (often a lot!) to be truly integrated.
In a world without walls and fences, who needs Windows and Gates?
 Quote

foniksonik

Anonymous
The symlink thing as a config string could work in a less-secure environment if you set up a variable path based on their username when they register.. ie: call the shell to make an individual folder for each user and then add a config path so that when they call 'files/[file_name]' 'files' gets replaced with [$username_files] or whatever. you could even hash or md5 it with their password for real security. Just some thoughts.
 Quote

foniksonik

Anonymous
I found the upload download script here: http://www.zachwhite.com/scripts.htm to be more feature rich that the class suggested. I have a fully integrated set of scripts available for any who are interested. e-mail: [NOSPAM]jhatfieldATavamar.com[/NOSPAM]
 Quote

All times are EST. The time is now 04:10 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content