Visit the LQ Articles and Editorials section
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 12-05-2007, 09:11 AM   #1
Senior Member
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 55
Php upload createdir deldir set of scripts

I have a webserver that I usually update through ftp. At the moment, I can only use http.

So I would need a set of php files to
-Upload files
-Create/delete directories
-Upload a tree zipped that would be extracted on the server would be a plus.

I think I can't use webdav. And secondly I want something minimal, not a complete framework.
At the moment, I have done upload file, quite simple. The rest wouldn't be too hard to do but I'm copying php code from here and there..
But I was wondering if something simple existed already??

Old 12-05-2007, 04:00 PM   #2
Registered: Aug 2005
Posts: 330

Rep: Reputation: 32
I believe there must be some sort of library to handle this sort of things, I'll search pear in a moment to see.
But it really isn't all that hard

Not sure what you mean with upload tree but this migh help:


here is a way I immediately found lots of scripts

this looks interesting

Haven't tested any of them though. Cheers

Last edited by nc3b; 12-05-2007 at 04:02 PM. Reason: add a link
Old 12-06-2007, 04:56 AM   #3
Senior Member
Registered: Sep 2005
Location: Out
Posts: 3,307

Original Poster
Rep: Reputation: 55
Yes I thought about pear.

Thanks a lot, I'll look at the links.
Old 12-11-2007, 11:52 AM   #4
Senior Member
Registered: Sep 2005
Location: Out
Posts: 3,307

Original Poster
Rep: Reputation: 55
I have used pfn.
It's much more than I wanted (I didn't need a sql backend, i'm the only uploader) but didn't bother searching something else.
To install it I used a php upload script (move_uploaded_file, available everywhere) and on the client I used this script:

PHP Code:

#File name needed
fichier=${1:?"Usage: $0 <filename> [<directory>] (Default directory:./)"}

#Default directory ./
#Trailing /
[[ "${dossier: -1:1}== "/" ]] || dossier="${dossier}/"

echo "+ Trying to upload ${fichier} to remote directory $dossier [${php}]"
[[ -${fichier} ]] || { echo "Error: File \"${fichier}\" not found!"; exit; }

curl --"dossier=${dossier}-"mfile=@${fichier}-"utilisateur=s3cr3t"  ${php} > ${ftemp}
grep -"Upload done" ${ftemp} && { echo "+ Upload Success" r=0; } || { echo "+ Upload Failed"r=1;}
$r == ]] && cat ${ftemp}
rm ${ftemp}
Use it like this:
./ filetoupload directorytoupload
+ Trying to upload ./navega.php to remote directory directory/./ []
+ Upload Success

Last edited by nx5000; 12-11-2007 at 11:53 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot upload files with php milescook Fedora 6 09-30-2006 02:04 AM
upload dir with php retrodict Programming 0 12-08-2004 03:52 AM
Upload Script....but not php vous Programming 1 02-04-2004 03:13 PM
ftp upload in php raven Programming 2 07-07-2002 06:33 PM
File upload via PHP!!! saravanan1979 Programming 0 02-14-2002 02:55 AM

All times are GMT -5. The time now is 03:21 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration