LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

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

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


Hi
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??

Thanks
 
Old 12-05-2007, 03:00 PM   #2
nc3b
Member
 
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

http://www.tizag.com/phpT/fileupload.php
http://www.php.net/mkdir
http://www.php.net/rmdir

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

http://www.php.net/manual/en/ref.zip.php
http://www.php.net/manual/en/functio...-extractto.php

EDIT:

here is a way I immediately found lots of scripts

http://www.google.com/search?client=...=Google+Search

this looks interesting http://platon.sk/projects/phpWebFileManager/home.php

Haven't tested any of them though. Cheers

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

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

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

Original Poster
Rep: Reputation: 52
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:
#!/bin/bash
php="http://myhost.com/upload.php"

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

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

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

ftemp=`mktemp`
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}
exit 
$r 
Use it like this:
Code:
./script.sh filetoupload directorytoupload
Quote:
+ Trying to upload ./navega.php to remote directory directory/./ [http://myhost.com/upload3.php]
+ Upload Success

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


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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


All times are GMT -5. The time now is 07:51 AM.

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