Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Having a problem with 'File Upload'
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01290258
Message ID:
01290270
Vues:
8
>I am seeing a problem encountered when attempting to upload a file to the web server using ASP.NET and VB.Net.
>
>I have never done this before so I went on Google and downloaded a few examples to examine. The following code exaple works as displayed below:
>
>
>
><html>
>
><head>
><meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
><title>Select File</title>
></head>
>
><body>
><form enctype="multipart/form-data" runat="server">
><table border="1" width="100%">
>	<tr>
>		<td colspan="2">
><input type="file" id="MyFileInput" accept="image/*" runat="server" name="F1" size="106" style="float: right" />Select File:</td>
>	</tr>
>	<tr>
>		<td>
><input type="button" id="SubmitButton" value="Upload"
>runat="server" onserverclick="UploadFile" /></td>
>		<td> </td>
>	</tr>
></table>
><p>   </p>
>
>
></form>
><div id="outError" runat="server" />
>
><script language="VB" runat="server">
>
>Sub UploadFile(objSource As Object, objArgs As EventArgs)
>	If Not (MyFileInput.PostedFile Is Nothing) Then
>		Try
>			MyFileInput.PostedFile.SaveAs("C:\temp\myfile.txt")
>		Catch objError As Exception
>			outError.InnerHtml = "Error saving file " & objError.Message
>		End Try
>	End If
>End Sub
>
></script>
>
></body>
>
></html>
>
>
>
>This code works, and actually uploads the file into the C:\Temp folder of the web server.
>
>But here's the problem: If I change the destination folder to a mapped network drive on another server, it won't work. I get an error stating:
>
>"Error saving file: Could not find a part of the path "G:\temp\myfile.txt"."
>
>Anybody have a solution for this?
>
>Thanks,
>
>-Steve

Did you try UNC path?
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform