Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> How to upload a serial files with php/html
bx93
post Sep 28 2004, 01:00 PM
Post #1


Member [ Level 2 ]
Group Icon

Group: Members
Posts: 68
Joined: 11-September 04
From: Hangzhou, China
Member No.: 488



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?
Go to the top of the page
 
+Quote Post
kilz
post Sep 28 2004, 01:10 PM
Post #2


Member [ Level 2 ]
Group Icon

Group: [HOSTED]
Posts: 52
Joined: 5-September 04
Member No.: 256



<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. . .
}
?>
Go to the top of the page
 
+Quote Post
marijnnn
post Sep 28 2004, 02:34 PM
Post #3


Premium Member
Group Icon

Group: [HOSTED]
Posts: 336
Joined: 22-September 04
Member No.: 798



are you sure this works? i don't think you can select a directory as the file to be uploaded in your form.
Go to the top of the page
 
+Quote Post
kilz
post Sep 28 2004, 02:45 PM
Post #4


Member [ Level 2 ]
Group Icon

Group: [HOSTED]
Posts: 52
Joined: 5-September 04
Member No.: 256



not sure, I typed the code with no checking.
but you can take a look of my photo album page.
http://koolkilz.webhostingcafe.com/gallery.php
I just the scripts that I've typed.
very simple and ugly. . .
Go to the top of the page
 
+Quote Post
bx93
post Sep 29 2004, 03:43 AM
Post #5


Member [ Level 2 ]
Group Icon

Group: Members
Posts: 68
Joined: 11-September 04
From: Hangzhou, China
Member No.: 488



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?
Go to the top of the page
 
+Quote Post
marijnnn
post Sep 29 2004, 10:37 AM
Post #6


Premium Member
Group Icon

Group: [HOSTED]
Posts: 336
Joined: 22-September 04
Member No.: 798



when input type is file you cannot choose a dir
the only thing you can do is make several input fields, for example 5 and then only one 'upload' button that will send 5 files simultanuous.

another option is to use www.net2ftp.com and zip your files and upload them all at once
Go to the top of the page
 
+Quote Post
bx93
post Sep 30 2004, 12:12 AM
Post #7


Member [ Level 2 ]
Group Icon

Group: Members
Posts: 68
Joined: 11-September 04
From: Hangzhou, China
Member No.: 488



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.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Friends Can't Start The Exe Files I Send :((5)
  2. Html Basic Tutorial(9)
  3. Good Books For Html And Css Beginners(1)
  4. Renaming collection of Pictures (files)!(15)
  5. Using Same Serial # On Multiple Copies Of Windows(18)
  6. How To Play *.rm Files With Media Player(13)
  7. Joomla Template Kit Extension For Nvu/composer(3)
  8. How Can I Delete Old Files In Windows Xp ?(21)
  9. Basic Html Tutorial(1)
  10. What You Need Before You Can Create A Text-based Game..(7)
  11. Converting PSD To HTML(9)
  12. Converting HTML over to XHTML(13)
  13. Need Some Help/advice On How To Restore Lost Files(5)
  14. How To: Display A Members/user List.(3)
  15. Playing Two Wav Files Simultaneously In C#(4)
  1. Indentation In Html(4)
  2. If You Have Some Private Files(17)
  3. Sharing Files In Windows Xp Home(15)
  4. How To Embed Swf Files In Joomla ?(9)
  5. Converting Flash Files To Gif(7)
  6. How To Hide Your Files In XP(18)
  7. Renaming Files (Using Excel Spreadsheet)(20)
  8. Creating Executable Jar Files(9)
  9. Web Editor(0)
  10. How To Transfer Files From One Computer To Another(16)
  11. Increase Your Knowledge Of Html Language(11)
  12. Get User Input From Vbscript For Batch Files(2)
  13. Style P And H? Html Tags(2)
  14. How Do I Chmod Files On Astahost ?(20)
  15. Switch Network Settings With Batch Files(18)


 



- Lo-Fi Version Time is now: 11th October 2008 - 12:03 PM