Uploading a file from Hard Drive to Webserver
Hi All, heres another good one... i have a form that allows users to upload a picture to the webserver for use on there profiles. what would be the most efficient way to...
A. obtain the file from the hard drive.
B. send the file to the webserver
B2. Store file on webserver as <username>.(gif/bmp/gif/png based on file extension)
C. then on another form i need to call the file name ( which will be stored in a database) into a picture box, resizing the image to the size of the picturebox.
Thanks so much
[552 byte] By [
vchatlive] at [2007-11-11 10:08:54]

# 1 Re: Uploading a file from Hard Drive to Webserver
Also if the picture exists i need it to overwrite the existing file with the new one if someone chooses to do so, im assuming it would be easy enough to delete then reupload. the other functions are more important right now Thanks!
# 2 Re: Uploading a file from Hard Drive to Webserver
Do you have FTP access to the Web server? FTP is the simplest method to transfer files over the Internet.
# 3 Re: Uploading a file from Hard Drive to Webserver
i have full control/access of the server, so yes ftp is an option, how would i be able to set that up with auto-overwrite on the uploads. Thanks.
# 4 Re: Uploading a file from Hard Drive to Webserver
Here's some sample code for FTP upload/download using the Internet Transfer Control. I don't know if the ITC supports auto-overwrite. If not, you may need to purchase a third-party FTP control, or use WinInet API calls to check whether the file exists on the server, and delete it if it does, before doing the upload.
# 5 Re: Uploading a file from Hard Drive to Webserver
im assuming, if theres a picture already there that when the user hits upload photo, it can automatically delete then send the next command to put the new picture up there
would that make sense? what control should i be using for this? so i can get some better ideas... i was thinking MS Internet Transfer controls 6.0
# 6 Re: Uploading a file from Hard Drive to Webserver
more importantly, how would one go about renameing a file during transfer
i.e. C:\photos\mypicture.jpg to http://mywebsite/userphotos/myusername.jpg
Thanks
# 7 Re: Uploading a file from Hard Drive to Webserver
well u have in the upload form a textbox that contains the username , a button which is on press > upload , and an event that mean upload is finished :
when the user press upload , get his username from the username texbox and when the event of finishing the upload rises , use a rename function to rename the file .. the reanme function must first get the file extension , remove name , put username and finally append extension back .
Amahdy at 2007-11-11 17:29:18 >

# 8 Re: Uploading a file from Hard Drive to Webserver
Great info so far, i need to design a form somehow though to find the files.
i.e. search folders for files that are pictures with jpg, gif, png or bmp extension. ifigured out how to put the drive, folder and file boxes on the form but i cant seem to get the boxes to change when i click on them. like when i change the drive it doesnt change the directories, and when i change directory it doesnt change files. any ideas? Thanks
Also, once thats figured out how does one go about getting the full Hard drive path to the file so it can then be uploaded. Thanks!!!
# 9 Re: Uploading a file from Hard Drive to Webserver
Explain more ? what u want to put in the form exactly ?
Amahdy at 2007-11-11 17:31:20 >

# 10 Re: Uploading a file from Hard Drive to Webserver
ive created a form with a drivebox, a folderbox and a file box, im assumning i need a textbox as well for the file name to show up in and an ok button to lock in the pathname as a variable, but i need to be able to use this form to search my local hard drive and find the images im looking for and i only want it to search for JPG right now.
# 11 Re: Uploading a file from Hard Drive to Webserver
well make this search in your filebox .. if (right(file1.list(i),4) = ".jpg" then 'it's a jpg ..
maybe it will be better to make index for them : when you upload the picture , write in a simple file the picture name and location ,, and when u want to search get info from this file .
Amahdy at 2007-11-11 17:33:19 >

# 12 Re: Uploading a file from Hard Drive to Webserver
no problems there, jsut need to know how to make the filebox and folderbox and drive boxes work on here where they update
any ideas on that one? i need a way to find the file to begin with
# 13 Re: Uploading a file from Hard Drive to Webserver
http://abstractvb.com/code.asp?A=709
Anyone that needs help with this, heres a great site, got everything working now! Thanks to everyone that helped
# 14 Re: Uploading a file from Hard Drive to Webserver
u need to know the file where this process go ? it must be in the server an ".asp" or ".php" or like that ... you should see where the upload request go and start from it .
Amahdy at 2007-11-11 17:36:18 >

# 15 Re: Uploading a file from Hard Drive to Webserver
I posted at the same time of yours but anyway that's g8t to find it yourself .. congs !
Amahdy at 2007-11-11 17:37:29 >

# 16 Re: Uploading a file from Hard Drive to Webserver
ok now theres another issue, i have the folders being created right and the path correct, but i cant seem to get the ftp command correct
inet1.execute (,put mypic)
any ideas?
# 17 Re: Uploading a file from Hard Drive to Webserver
inet1.execute "STOR " + mypic
still not working, im not quite sure what the ftp commands should be
# 18 Re: Uploading a file from Hard Drive to Webserver
mypic is avariable ? which type ?
if mypic isn't a variable :
inet1.execute "put mypic"
if it's:
inet1.execute "put" & mypic
i don't know if the ftp command is correct I only try to help in vb format ..
the next post should be : "STOR" & mypic 'if mypic is a string variable too .
Amahdy at 2007-11-11 17:40:24 >

# 19 Re: Uploading a file from Hard Drive to Webserver
this has been resolved, images are uploading perfectly now! Thanks so much to everyone that helped!