Uploading html file to web server

Joined
Aug 26, 2006
Messages
6
Programming Experience
3-5
hi all,
am facing a weird problem while uploading an html file to the web server. Am using an <input type=file runat=server id=file1> control. then when the user is clicking upload the following code part is getting executed
VB.NET:
if file1.value.trim<>"" then
 if file1.postedfile.contentlength > 0 then  
  dim file_name as string=file1.postedfile.filename
  dim file_ext as string=path.getExtension(file_name)
  dim name_only as string=path.getFileName(file_name)
  if file_ext=".htm" or file_ext=".html" then
   me.file1.postedfile.saveAs(server.mapPath(name_only))
  end if
 end if
end if

Now when an html file containing images in it like <img src="c:\abc.jpg">
is uploaded, the text contents of the html file are getting saved but the image is not coming along with the html file. What can I do to make this work...plzzz suggest
 
A html file doesn't contain any images, it only contains plain text with markup codes. The image tag only links to another file so the browser that interprets the html code can download and present the image to user when viewing the page.
 
I would say it answers your question. There is no 'link' between a html file and other files except what is described in the html code. If you got a html and want something described in that file you have to read the html file and find out what that could be and if it is available at the described location. Then you can download the file. What sounds like from your request is a upload form for html files. It is not possible for this form to also take these images or whatever linked files in the same go. If user want to upload files to you then user must specify all relevant files.
 
Back
Top