?
Solved

ASPX upload error to godaddy shared server

Posted on 2007-10-11
11
Medium Priority
?
1,367 Views
Last Modified: 2008-01-09
I have an aspx page with c# code behind, on the page I have a place where users can upload photos using this code in my .cs file:

// Send Upload
         {
            string strFileName;
            {
                UploadConfirmationTextBox.Text = "";
                strFileName = FileUpload.PostedFile.FileName;
                strFileName = strFileName.Substring(strFileName.LastIndexOf("\\") + 1);
                try
                {
                    FileUpload.PostedFile.SaveAs(HttpContext.Current.Request.PhysicalApplicationPath.ToString() +"\\Upload\\UploadedPics\\Origionals\\" + PictureNumberString);
                   
                    UploadConfirmationTextBox.Text = "Uploaded successfully: " + strFileName;
                }
                catch (Exception)
                {
                    UploadConfirmationTextBox.Text = "Error Uploading " + strFileName;
                   
                }
            }
        }

It works on my local machine just fine, but the site is on a godaddy shared server, I have permissions set to Read,Browse,Web and Write but I get "Error Uploading" when trying to send the file. What can I do?
0
Comment
Question by:cbrick04
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 14

Expert Comment

by:Jai S
ID: 20063073
check whether this path exists in the server ...where you are trying to save teh file.,,,

\\Upload\\UploadedPics\\Origionals\\"
0
 
LVL 22

Expert Comment

by:RedKelvin
ID: 20063101
Hi there modify your catch statement

                catch (Exception e)
                {
                    UploadConfirmationTextBox.Text = e.Message;
                   
                }

That will provide more information on the actual error.

It may be that the server is not configured correctly. Try a very small file, they may have an upload size limit set.
0
 
LVL 21

Expert Comment

by:tovvenki
ID: 20063106
Hi,
for testing change the catch block like this
catch (Exception ex)
                {
                    UploadConfirmationTextBox.Text = "Error Uploading " + strFileName + " because of " + ex.Message
                   
                }

this will give you the exact error message which will help in identifying a solution.
let me know what is the message that you are getting after you modify the catch block.

regards,
Venki

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:cbrick04
ID: 20063198
This is the error message i get:
Error Uploading CesarChavez.jpg because of Could not find a part of the path 'd:\hosting\JackMan\WebsiteFolder\Upload\UploadedPics\Origionals\2617.JPG'.CesarChavez.jpg
0
 
LVL 22

Expert Comment

by:RedKelvin
ID: 20063208
you have 2 file names in that path 2617.JPG and.CesarChavez.jpg

I would say that the last file name should not be there

If this is just a typo, make sure that this path does exist on the server
0
 
LVL 22

Expert Comment

by:RedKelvin
ID: 20063213
Basically what you have there is not a valid path, there is a filename outside the quotes.

Is this the folder that you were expecting to upload to, if not, you may have to set the permissions on this folder too.
0
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 20063217
just like jaiganeshsrinivasan said, check the path and see if it exists on Godaddy or not
You can something like this
string sPath=HttpContext.Current.Request.PhysicalApplicationPath.ToString()) +"\\Upload\\UploadedPics\\Origionals\\";
if (System.IO.Directory.Exists(sPath))
            Response.Write("Path exists");
else

Response.Write("Path do not exists");

you can do this on a test page or before you attempt to upload any files

0
 

Author Comment

by:cbrick04
ID: 20063258
I changed the path to the root folder and I get this error:

Error Uploading CesarChavez.jpg because of Access to the path 'd:\hosting\JackMan\WebsiteFolder\2623.JPG' is denied.CesarChavez.jpg
0
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 20063269
see the path d:\hosting\JackMan\WebsiteFolder\2623.JPG <<-----2623.JPG--->> This is not a valid path, you have an image here
your path should be d:\hosting\JackMan\WebsiteFolder\\
Nothing after it

0
 
LVL 22

Accepted Solution

by:
RedKelvin earned 2000 total points
ID: 20063273
Also the access denied error is just that, you do not have permissions to write to that folder
0
 

Author Comment

by:cbrick04
ID: 20063428
The access was being denied by because I had to set permissions for each individual folder, got it fixed, thank you all for your help.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month15 days, 18 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question