473,326 Members | 2,148 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

upload multiple files if filenames are known in advance

170 100+
Given that I'm trying to automate the process of uploading 20-30 files at a time (and I have to do this regularly), and the filenames are always the same each time (eg. it's always file1.gif, file2.gif, etc), is there some way I can automate this using php? At present, I have a simple form which uploads one at a time, but obviously at this stage I have to keep going back and choosing the file again and again. Is there some way I can tell the script where to get each file without using the browse/upload form as per normal? And then perhaps once it's uploaded the first one, automatically upload the next, and keep going until all the files are done? ftp is not an option. security is not an issue as this is an internal site.

Any suggestions/advice/help would be appreciated. I'm not an expert, but also not a complete newbie.

Thanks
Feb 16 '07 #1
9 2001
ronverdonk
4,258 Expert 4TB
Put your upload code in a function.
Store your file names in an array.
Loop through that array, calling the upload function at each cyle, until you have processed all array entries.

Ronald :cool:
Feb 17 '07 #2
beary
170 100+
Thanks once again Ronald!
Feb 18 '07 #3
ronverdonk
4,258 Expert 4TB
You are welcome.

Ronald :cool:
Feb 18 '07 #4
beary
170 100+
Update...

I asked a friend about doing this and he replied:

"its not possible. Its a security measure in
php, and browsers, that they just cant upload any files without you
filling in the input box."

Is this true? If so, it would mean the method above of storing filenames in an array, putting the upload procedure in a function and then calling the function for each file in the array would not work.

Any clarification? Does my friend know what he's talking about?
Feb 20 '07 #5
beary
170 100+
Well I guess I'll provide clarification. It turns out the automating process cannot be done. In other words, the whole array with filenames, then loop through the array is not possible...for anyone else who wondered...
Feb 21 '07 #6
ronverdonk
4,258 Expert 4TB
I am so sorry, but your friend is right!

I was thinking about an FTP upload from an array. And I completely overlooked your statement that you could not use FTP for this.

I am terribly sorry about the confusion I caused you.

Ronald :cool:
Feb 21 '07 #7
beary
170 100+
No problem at all! I'm just glad to have some closure on it. I've ended up achieving the same thing using a zip class, uploading the zipped file (containing all my files), extracting the file using the class and then deleting the zip file. It works well...
Feb 21 '07 #8
ronverdonk
4,258 Expert 4TB
I am glad you found a solution to your problem. Wish I had seen your no-FTP before. Come back here any time.

Ronald :cool:
Feb 22 '07 #9
tolkienarda
316 100+
here is a link that i found useful trying to do the same thing you were trying to do
http://www.it-guru.co.uk/showthread.php?t=923

it is a script to uploading multiple files dunno if it can be modified to do what you want.

eric
Feb 22 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Philippe Lemmerling | last post by:
I have a question concerning security of my file upload script. I'm using the php upload routines (move_uploaded_file,...) and variables ($_FILES) to upload images to a webdirectory. Everything...
1
by: TK | last post by:
I have a file upload control to allow a user to select/upload a file to the server. They need to upload x number of files in one shot because they have to confirm that they are uploading x number...
1
by: Susan | last post by:
Is it possible to use PHP with VBScript or JavaScript to upload multiple files. I'd like to automate the upload of a complete directory (not using FTP). I don't need a common form with several...
3
by: JFB | last post by:
Hi All, It's a way to upload multiple files on a web site using vb.net 2005? I see the uploadFile tool, but it's only for one file. Any ideas, examples, links??? Tks in advance JFB
0
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
43
by: bonneylake | last post by:
Hey Everyone, Well this is my first time asking a question on here so please forgive me if i post my question in the wrong section. What i am trying to do is upload multiple files like gmail...
3
by: Kai Apel | last post by:
Dear Newsgroup, My name is Kai from Germany and I`m trying to learn VB.Net. My first Project is a simple Form with a button, witch is starting the filedialog for multiselect file. All thats...
0
AnuSumesh
by: AnuSumesh | last post by:
Hi We have an application where we can upload file from client machine to any shared device on the network. Now our requirement is to upload multiple files over the network. e.g. to path...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.