Adding upload functionality

Asked by RACooper

I would like to figure out if it's possible to integrate an upload script like Silentium Uploader (http://hypersilence.net/silentum_uploader.php) into the phpns admin interface. it doesn't even have to integrate visually, just be available by a link in the menu or something like that. I've dug a little bit but I'm not really sure where to start trying to add something like that. Any help would be appreciated!

Question information

Language:
English Edit question
Status:
Solved
For:
phpns Edit question
Assignee:
No assignee Edit question
Solved by:
RACooper
Solved:
Last query:
Last reply:
Revision history for this message
RACooper (racooper) said :
#1

Actually, after a few days of messing with this, I have managed to integrate the upload utility both into the menu and the admin theme. It does require changing two core files: inc/gloval_files.php and themes/default/admin.tpl.php. It also requires changes to upload.php from Silentium Uploader to be able to use the template system. I need to package up the changes in case anyone wants them....I'll post here with a URL once I have that done.

Revision history for this message
alecwh (alecwh) said :
#2

Please do! You are also free to push the bzr repository (if it is one,
and if not, you can make it one!) into Launchpad.

Revision history for this message
RACooper (racooper) said :
#3

here is my archive of just the modified/added files to incorporate the upload functionality:

http://www.noidea.us/download.php?f=phpns-upload-patch.zip

I don't know anything about bazaar so feel free to incorporate it however you want. I've included the readme for hypersilence.net in the docs folder of the archive.

NOTES:
1) modified the uploader.php from it's original to ignore index.php in the ../files/ folder, so any attempt to access the folder directly will result in being bounced back to the site homepage.

2) added .pdf as an allowed extension.

3) changed $maximum_file_size from 50k to 8MB.

4) changed the upload directory from "files/" to "../files/" on line 29. did not change line 30, so "files/" should be in site root.

5) modified upload.php to output into the $content variable to integrate with phpns templates, added note that spaces in upload filenames would be converted to underscores, and changed approx upload max calculation to be MB instead of KB.

6) added upload.php to the $rep_patt[] array in inc/global_files.php.

7) added images/upload.png, borrowed from the Tango Icons set.

8) added "upload file" link to menu <UL> in themes/default/admin.tpl.php.

if you find any problems with it please let me know, you can post a blog comment at http://www.noidea.us/blog/index.php?entryid=54 just remember that I moderate all comments, so it may not show up immediately but I will be notified when it's entered.

Revision history for this message
alecwh (alecwh) said :
#4

Very interesting! I'll check this out soon, and if I like it, perhaps I
will merge it with the development branch!

I'll respond here with any updates/questions (it's just easy that way -
keep it all in one place), hopefully you'll be around to respond!