Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADODB.Stream with FTP folder

Status
Not open for further replies.

thompom

Technical User
Dec 4, 2006
395
0
0
GB
Hi, am stuck... again

have a form where a user selects an image on their local drive and then press a button it writes the filename to a database and uploads the image to my server

now the database side is working fine but the image upload part is where i am stuck.

i have an ftp folder on my server that has been setup with permissions and requires a username/password
and im using ADODB.Stream method to upload my files to the server.

can i use this with ftp? i cant see where to put the user/password into my code
if this is not the right option can you suggest an alternative

at the moment i get

Code:
ADODB.Stream error '800a0bbc'

Write to file failed.

/autobase/bigadedit.asp, line 446

line 446 of my code is

Code:
oStream.SaveToFile (x_adpath & ewUploadFileName(fn_x_smallad) ) , 2

my full code for uploading is
Code:
' Save to File
Set oStream = Server.CreateObject("ADODB.Stream")
oStream.Type = 1 ' 1=adTypeBinary
oStream.open
oStream.Write ConvertToBinary(sTmp)
oStream.SaveToFile (x_adpath & ewUploadFileName(fn_x_smallad) ) , 2 ' 2=adSaveCreateOverwrite
response.Write (x_adpath & ewUploadFileName(fn_x_smallad))
oStream.close
Set oStream = Nothing

 
thanks monksnake - nice script but doesnt seem to include any login details for ftp access, could be wrong - only skimmed it quick!
 
No you are right, there is no reference to FTP. It doesn't use FTP.

[monkey][snake] <.
 
also thought i would mention - am hosted with fasthosts
and the only way of storing files on the server is by secure ftp access - no anonymous logins.
 
So the file goes from the browser to the web server over HTTP.

... but then, while the file is stored in a Stream object in the web server's memory, instead of writing it to the local disk on the web server you want to write it back out over the network using FTP. Is that correct?
 
thanks for you reply - to clarify

users need to upload images to the webserver from a web browser on their local machine

the webserver is the same server they want to uload files to
 
...aah see what you getting at - there is no need for ftp access, put in the local path on the server hit the button
and the file was written in the folder

thanks again sheco
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top