Reply
Uploading to more than one directory?
Old 02-12-2008, 03:08 AM Re: Uploading to more than one directory?
chrishirst's Avatar
Super Moderator

Posts: 11,452
Location: Blackpool. UK
Quote:
Any help to alternate the uploads to Input and then Input2, would be appreciated. Thanks.
More input, need more input. (sorry watched Short Circuit over the weekend with the kids )

Are you uploading several files at once or uploading one file at a time?

Does it need to save state so if the user looses connection or returns to upload more the next file is put in the right place.

Is this an image uploader with thumbnail and main image arrangement? Because I coded a way around needing seperate folders for this setup by using prefixes or suffixes for the filenames to identify the thumbs from the main when I started rewriting one application.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-12-2008, 09:24 AM Re: Uploading to more than one directory?
Super Talker

Posts: 113
Thank you for your reply.

It is set up to upload one file at a time.

Quote:
Does it need to save state so if the user looses connection or returns to upload more the next file is put in the right place.
I'm not really clear on what you mean here. But, there is no "right place". When a file arrives (by upload) into a directory A, it is grabbed and processed. I'm simply trying to split up the load on a single directory, so files can be grabbed simultaneously from directory A & directory B, so as to speed up the processing time.

No images are uploaded.

Thanks. I look forward to your reply.
chrisj is offline
Reply With Quote
View Public Profile
 
Old 02-12-2008, 09:45 AM Re: Uploading to more than one directory?
chrishirst's Avatar
Super Moderator

Posts: 11,452
Location: Blackpool. UK
Quote:
so files can be grabbed simultaneously from directory A & directory B, so as to speed up the processing time.
Processing time of what? Because you could be wasting your time totally even bothering about this.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-12-2008, 12:27 PM Re: Uploading to more than one directory?
Super Talker

Posts: 113
Thanks for your reply.

The upload script uploads to a directory and the files in the directory get grabbed and automatically translated, using another type of script. So, instead of translating one file at a time , the script will be processing two files at a time, thus speeding up the translation processing time, if I can get files uploaded to seperate alternate folders, via the freeASP upload script.

Last edited by chrisj : 02-12-2008 at 12:29 PM.
chrisj is offline
Reply With Quote
View Public Profile
 
Old 02-12-2008, 03:31 PM Re: Uploading to more than one directory?
Learning Newbie's Avatar
Moderator

Posts: 4,585
Name: John Alexander
Do you need to log uploads, or is there any value?

What you need is a mechanism for knowing whether the last file went into your A or B folder. Although it sounds like a much better idea would be to count how many files (or bytes?) are in each folder when an upload completes, and then send the new file into the smaller folder??
__________________
4 ways to improve the lives of the "bottom billion"

"HEY YOU KIDS GET OFF MY LAWN!" -John McCain
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 02-12-2008, 06:11 PM Re: Uploading to more than one directory?
Super Talker

Posts: 113
Logging uploads is not neccessary.

I don't even neccessarily need to know "whether the last file went into your A or B folder". If this upload goes to Input, the next one should go to Input2, then the next one should go to Input, then the next one goes to Input2, etc.

Yes, counting which has the smallest amount would be good, though more complex than i'm looking for. I'm just wondering if it can upload to one place then another.

thanks again.
chrisj is offline
Reply With Quote
View Public Profile
 
Old 02-12-2008, 06:58 PM Re: Uploading to more than one directory?
Learning Newbie's Avatar
Moderator

Posts: 4,585
Name: John Alexander
It can be uploaded to one place and then a different place next time, and then circle around to an infinite loop. In fact there are many ways to accomplish this task - which is what these questions are on about. Trying to narrow it down from 100s of choices to 1.

Believe it or not, figuring out which directory has less stuff in it might be less complex to code than going A, B, A, B, A, B, A, B, A, B, A, B, A, B, A, B, A, B, A, B and so on. The reason is because to do that, you need to know the last place you saved the file. And to do that, we need some kind of logging or a different mechanism.

If you keep a log of uploads, you can store things (that you don't seem concerned over) like the user name and IP Address. Along with this information you can store what directory the file went into. Then, after somebody uploads a file, your ASP code would check the log, pulling up the most recent entry to find what directory that file was saved to - and then write to the other directory.

Instead of writing this information to a database table, you could use a flat file. In fact you could write ONLY the name of hte last directory you used. That would take less work to code - at least at first blush. Because you've got a server app, it's possible two people could save a file at the same time, then you have locking issues with the file. So I wouldn't recommend that route.

You've already seen how you can create a variable, "hard code" it to C:\Input2 and then have everything go there. Instead, you need a more intelligent way to put the correct folder name in that variable right before you save the file. It could be by logging. It could be some other means. It could be by running a count of the files in each directory and returning the one with the least stuff in it.

I'd probably go with the last because (1) if you don't need a log this way is the least work for the most payoff and (2) if you're using 2 directories for load balancing, this will get you better balance.
__________________
4 ways to improve the lives of the "bottom billion"

"HEY YOU KIDS GET OFF MY LAWN!" -John McCain
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 02-12-2008, 07:09 PM Re: Uploading to more than one directory?
Super Talker

Posts: 113
Thank you for your thoughts on this. I really appreciate it. I would be happy with a simplistic scenario.

I'm interested in "the least work for the most payoff and (2) if you're using 2 directories for load balancing, this will get you better balance", but I don't know where to go from here. Can you provide some guidance, please?

thanks.
chrisj is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Uploading to more than one directory?

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.35521 seconds with 12 queries