Hi All
I am trying to allow users of my site to upload images to the server the form
I am using is below
<form id=“Form1” method=“post” runat=“server”>
<P>
Browse to Picture<br>
<INPUT type=“file” id=“MyFile” runat=“server”>
<BR>
<br>
When you have selected your picture click upload<BR>
<asp:Button id=“btnUpLoad” runat=“server” Text=“Upload”></asp:Button></P>
<P>
<asp:Label id=“lblInfo” runat=“server”></asp:Label></P>
<a href=“MyProfile.aspx”>My Profile</a>
</form>
The code behind below
Private Sub btnUpLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpLoad.Click
If Not MyFile.PostedFile Is Nothing Then
Dim strFileName As String
Dim intFileSize As Int32
strFileName = MyFile.PostedFile.FileName
intFileSize = MyFile.PostedFile.ContentLength
lblInfo.Text = strFileName & " " & "/" & " " & intFileSize
MyFile.PostedFile.SaveAs("c:\\Inetpub\\wwwroot\\JtaForumMySql\\ProfileImages\\ProfilePic_User_" & Session("UserID") & ".jpg")
End If
End Sub
The session is set during login
The problem is that sometimes (not always) I get the dreaded error
The process cannot access the file “c:\Inetpub\wwwroot\JtaForumMySql\ProfileImages\ProfilePic_User_6.jpg” because it is being used by another process.
Can anyone help me please