Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Community Discussions (All other subjects)
 ASP Upload script with file renaming?
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

D3mon
Senior Member

United Kingdom
1685 Posts

Posted - 08 December 2003 :  06:59:17  Show Profile  Visit D3mon's Homepage
Can anyone suggest an ASP upload script that will allow me to rename the file, on-the-fly, before saving it to the server?

Most of the scripts I've found don't even consider this possibility and seem to only allow the file to be stored with its original name.


Snitz 'Speedball' : Site Integration Mod : Friendly Registration Mod
"In war, the victorious strategist only seeks battle after the victory has been won"

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 08 December 2003 :  07:09:17  Show Profile  Visit HuwR's Homepage
I'm pretty sure most of them should allow that, certainly all the ones I have tried will allow you to set the name it is saved as.
Go to Top of Page

D3mon
Senior Member

United Kingdom
1685 Posts

Posted - 08 December 2003 :  07:25:30  Show Profile  Visit D3mon's Homepage
FreeASPUpload seems to be the best one at the moment and suggests in the documentation that it is possible, but I'm at a loss to get it working. I'm wanting to set the new file name as a hidden form element (when the file is selected) so it gets sent within the form content.


Snitz 'Speedball' : Site Integration Mod : Friendly Registration Mod
"In war, the victorious strategist only seeks battle after the victory has been won"
Go to Top of Page

D3mon
Senior Member

United Kingdom
1685 Posts

Posted - 08 December 2003 :  08:00:15  Show Profile  Visit D3mon's Homepage
I've worked out that this part of the code saves the files to the server:
For Each fileItem In UploadedFiles.Items
 Set streamFile = Server.CreateObject("ADODB.Stream")
 streamFile.Type = 1
 streamFile.Open
 StreamRequest.Position = fileItem.Start
 StreamRequest.CopyTo streamFile, fileItem.Length
 streamFile.SaveToFile path & "testfile.jpg", 2
 streamFile.close
 Set streamFile = Nothing
 fileItem.Path = path & fileItem.FileName
Next

I can preset the name in the code - "testfile.jpg" and it works, but if I try to use request.form("") in place of it, to grab another form field, I get an error saying the request.form object wasn't allowed.


Snitz 'Speedball' : Site Integration Mod : Friendly Registration Mod
"In war, the victorious strategist only seeks battle after the victory has been won"
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 08 December 2003 :  08:18:53  Show Profile  Visit Gremlin's Homepage
Your host doesnt have any nice COM objects installed by chance ? many seem to have Persits uploader installed becuase its free, its got pleanty of features too.

If your not sure what COM objects your host does support try downloading and running this it identifies almost 700 COM objects.
http://www.bier-voting.de/objcheck/query.zip

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

D3mon
Senior Member

United Kingdom
1685 Posts

Posted - 08 December 2003 :  09:09:31  Show Profile  Visit D3mon's Homepage
Oh man, the server does have Persits Uploader loaded! I'll get a closer look at how to use it. Thanks guys.


Snitz 'Speedball' : Site Integration Mod : Friendly Registration Mod
"In war, the victorious strategist only seeks battle after the victory has been won"
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 08 December 2003 :  18:08:35  Show Profile  Visit Gremlin's Homepage
Great :)

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.29 seconds. Powered By: Snitz Forums 2000 Version 3.4.07