473,507 Members | 6,459 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Image Uploader; Worked in .NET 1.0 now not working in 1.1?

Hi,

I have recently upgraded .NET from 1.0 to 1.1 and now an application I am
writing is no longer uploading the files, any ideas? I have posted the
relevant code below...

<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%@ Import Namespace="System.Text" %>
<script runat="server">

void Button1_Click(object Source, EventArgs e)
{
txtMsg.InnerHtml = saveFiles();
}
string saveFiles() {
string strMessage = "";
string[] uploadArray = new string[6];
string strFileName;
string propertyPath;
string thumbnailPath;
string appPath;
string iString;
string propertyIdLocal;
string uploadPhoto1Local;
string uploadPhoto2Local;
string uploadPhoto3Local;
string uploadPhoto4Local;
string uploadPhoto5Local;
string uploadPhoto6Local;
HttpPostedFile objFile;

propertyIdLocal = MC_propertyId.Text;

appPath = Server.MapPath("../photos/");
Directory.CreateDirectory(appPath+propertyIdLocal) ;
Directory.CreateDirectory(appPath+propertyIdLocal+ "/thumbnails");
propertyPath = Server.MapPath("../photos/"+propertyIdLocal+"/");
thumbnailPath = Server.MapPath("../photos/"+propertyIdLocal+"/thumbnails/");

for (int i=0; i<Request.Files.Count; i++) {
objFile = Request.Files[i];
if (objFile.FileName != "") {
strFileName = objFile.FileName;
strFileName = strFileName.Substring(strFileName.LastIndexOf("\\" )+1);
try {
objFile.SaveAs(propertyPath+strFileName);
System.Drawing.Image image =
System.Drawing.Image.FromFile(propertyPath+strFile Name);
System.Drawing.Image thumbImage =
image.GetThumbnailImage(Convert.ToInt32(100),Conve rt.ToInt32(75),null,IntPtr.Zero);
image.Dispose();
thumbImage.Save(thumbnailPath+strFileName, ImageFormat.Jpeg);
iString = ""+i+"";
uploadArray[i] = strFileName;
strMessage+= "Uploaded: "+strFileName+"<br>";
}
catch (Exception err) {
strMessage+= "Failed uploading "+strFileName+":
"+err.ToString()+"<br>";
}
}
}

uploadPhoto1Local = uploadArray[0];
uploadPhoto2Local = uploadArray[1];
uploadPhoto3Local = uploadArray[2];
uploadPhoto4Local = uploadArray[3];
uploadPhoto5Local = uploadArray[4];
uploadPhoto6Local = uploadArray[5];

MC_propertyPhoto1Hidden.Text = uploadPhoto1Local;
MC_propertyPhoto2Hidden.Text = uploadPhoto2Local;
MC_propertyPhoto3Hidden.Text = uploadPhoto3Local;
MC_propertyPhoto4Hidden.Text = uploadPhoto4Local;
MC_propertyPhoto5Hidden.Text = uploadPhoto5Local;
MC_propertyPhoto6Hidden.Text = uploadPhoto6Local;

return strMessage;
}
....

The page returns no errors and doens't perform the 'return strMessage;' as
it used to.

Thanks for your help.
Aug 26 '05 #1
0 1013

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
11737
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
0
210
by: grahamhe | last post by:
Hi, I have recently upgraded .NET from 1.0 to 1.1 and now an application I am writing is no longer uploading the files, any ideas? I have posted the relevant code below... <%@ Page...
2
1771
ak1dnar
by: ak1dnar | last post by:
Hi, Future Photo is using Basic uploader and advanced uploader to upload images to there albums, My question is how to build up this kind of advanced uploader in php. As i feel its related with ...
2
1308
by: harikrishnan4u | last post by:
How can we check the image size in rad uploader this file uploader is in the rad editor??any one Know
0
7223
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
7372
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...
1
7030
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.