473,387 Members | 1,844 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,387 software developers and data experts.

Problem with upload

42
I'm facing some problems with upload form. Following code doesn't work for some reason

try
{

strFileName1 = MyFile1.PostedFile.FileName;
strFileName1 = System.IO.Path.GetFileName(strFileName1).Replace(" ","_");
MyFile1.PostedFile.SaveAs(Server.MapPath("files/") + "[" + ID+ "]" + strFileName1);

//file should be saved to 'files' sub folder
}

catch(Exception)
{
strFileName1 = "error!1";
}
string file1="[" + ID + "]" + strFileName1;

myCommand.CommandText = "UPDATE main_table SET File1_1='" + file1 +"'where ID=" + ID;
myCommand.ExecuteNonQuery();

After executing I always get the "error!1" as defined in catch to database. Can someone help me.
May 21 '07 #1
0 696

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

Similar topics

0
by: Paul Hamlington | last post by:
Hello, I've been programming in ASP for a little while now and quite an advanced user, but I have come across an unusual problem in which I need assistance. I have built my own image upload,...
3
by: John Rebbeck | last post by:
(sorry about cross posting but I really need help with this and it fits in both newsgroups) I'm creating a little image manager and I'm using Persits ASPUpload. I have an UploadButton and...
4
by: NohaKhalifa | last post by:
Dear All; I'm developing a web site and i need to make adminisration for this site it's a site for Real Estates . But I don't need the administration to be online .. I want them to fill data...
3
by: Tim::.. | last post by:
Can someone please tell my why I get the following problem when I type the following piece of code! How do I get around this??? The idea is that when a user clicks a button on a form it causes...
2
by: prakharv | last post by:
Hi All, Below is the code which I am using to upload a jpeg file to the server. But the problem I am facing is that it is not copying the entire contents of the image file to the webserver and it...
0
by: RichBurdes | last post by:
Hi All, I've just started using ASPupload and can successfully submit files to a directory on the web server and form data to a database - i can then retrieve the form data and links to the files...
4
by: Muddasir | last post by:
Hi.. i am having a strange problem.......the problem is i am trying to upload a file and to store it in db....when the file got stored in db...it got converted into black and white image and...
12
by: K. | last post by:
Hello! I have a problem with SWFupload class1. I have the page with uses SWFUpload class. Everything worked fine until (I suppose my admin) implemented some changes into the server. Now uploading...
2
by: swethak | last post by:
Hi, i wrote a code to upload a image.In my local it works fine. When i place this code in website through FTP. In that it will not works. i am giving the upload path ../upload . When i try to...
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: 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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.