473,386 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

file upload control

5
I'm trying to add a file upload control to aspx page on my site, I've dragged the control onto the page and added a submit button beside it, the code for the button was this;

I done it in asp.net with vb script

FileUpload1.SaveAs("C:\Documents and Settings\User\Desktop\New Folder" & FileUpload1.FileName)

Now that worked fine, I tested the page and after clicking submit the file I specified was then inside this folder. But the I changed the code to this;

FileUpload1.SaveAs(http://www.mysite.com/test/Uploads/ & FileUpload1.FileName)

All I done was changed it so it should save the file to a folder on my server instead of a folder on my computer but it didn't work

It shows following error :

The SaveAs method is configured to require a rooted path, and the path 'http://www.mysite.com/test/Uploads/enter.swf' is not rooted.

How I understand it is I can only use the 'SaveAs' function if the file is to stay on a computer, I can't use it to save the file on a server.
How do I get around this so the files my visitors upload will be saved in the Uploads folder on my server?

I'd really appreciate some help with this as I'm completely stumped.

Kind Regards
Shini
Jul 13 '08 #1
2 909
vinot85
53
All you have done is right,

In order to save a file at Server, you should use like,

file1.SaveAs(Server.MapPath("\Uploads\" & file1.name & ".jpg"))

This Server.MapPath() method will map your application to correct virtual path where your application is running.

Now ur files will be saved at dir called "Uploads" in your virtual directory.

Make sure that enc-type attribute of your web form is having the value
"multipart-form/data"

Regards,

Vinoth
Jul 15 '08 #2
Shinis
5
Thank you Vinoth..................
Jul 23 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

20
by: CHIN | last post by:
Hi all.. here s my problem ( maybe some of you saw me on other groups, but i cant find the solution !! ) I have to upload a file to an external site, so, i made a .vbs file , that logins to...
1
by: TK | last post by:
I have a file upload control to allow a user to select/upload a file to the server. They need to upload x number of files in one shot because they have to confirm that they are uploading x number...
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
5
by: George Durzi | last post by:
Anyone know of a good file upload control? I don't like using the built in one because it's unable to maintain state on a refresh. Thanks!
3
by: Bijoy Naick | last post by:
I've written a simple file upload user control in VB .NET. It comprises of an InputFile HTML Server Control, an Upload button and a message label. User clicks on the Browse button of the...
3
by: Sarav | last post by:
Hi All, I need to upload an XML file via an client side ActiveX control. I searched the web but everywhere got the samples of using file control alone. How can I upload a file into my web server...
12
by: GuangXiN | last post by:
I want the file upload element disappear, instead of it, I place a text box and a button with my own css defination. but it doesn't work on IE7. What should I do now? <form action="upload.php"...
7
Curtis Rutland
by: Curtis Rutland | last post by:
Building A Silverlight (2.0) Multi-File Uploader All source code is C#. VB.NET source is coming soon. Note: This project requires Visual Studio 2008 SP1 or Visual Web Developer 2008 SP1 and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.