Jump to content
xisto Community
Sign in to follow this  
bx93

How to upload a serial files with php/html

Recommended Posts

With Eric's help, I could deal with the upload operation with one image file now.However, I still want to upload a set of local files, maybe the gif files in one directory, is there anyone know how to deal with php and html?Is it possible for me to upload all the image files in one directory which was only given by its path name?

Share this post


Link to post
Share on other sites

<form action=$_SERVER[php_SELF] method="POST" enctype="multipart/form-data"><input type="file" name="file"></form><?if (strrchr ($_FILES["file"], ".") != ".gif" || strrchr ($_FIELS["file"], ".") != ".jpeg" || strrchr ($_FIELS["file"], ".") != ".png") {echo "not image!!";} else {$time = time(); // for file name. . .copy ($_FILES["tmp_name"], "folder/".$time.$_FILES["name"]);mysql_query ("insert into database (image) values ('$time$_FILES[name]');//I use time for file name, no same file name will be the same folder. . .}?>

Share this post


Link to post
Share on other sites

Thanks kilz, I tried your form script:<html> <body><form action="setload.php" method="POST" enctype="multipart/form-data"><input type="file" name="file"></form> </body> </html>and I copy your php script to a file named setload.php.However it couldn't solve my problem. There is only one button which could use to choose one file. I wonder if I could choose one directory. Besides, could the function copy in php copy the file from client side to server side? Otherwise, there should be file transfer, but how to do it?

Share this post


Link to post
Share on other sites

I see. There are many sites provide multi-files loading with multi input fields. However, I did find several sites can upload all the images in one directory to the server as we chose a certain directory. So there should be some solution to upload a directory.To zip a set of files is ok to transfer the data to the server, but we should unzip the files at the server side then, it makes some trouble.I'm thinking there should be some API/ActiveX alike objects in windows/linux could support the upload of a directory.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.