LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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
 
Search this Thread
Old 12-05-2007, 09:11 AM   #1
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 53
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, 04: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 04:02 PM. Reason: add a link
 
Old 12-06-2007, 04:56 AM   #3
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

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

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

Original Poster
Rep: Reputation: 53
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 11: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


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:08 PM.

Main Menu
Advertisement
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