باسلام و احترام
من یک کد برای آپلود عکس در ASP.NET با زبان VB.NET نوشتم . برنامه همه عکسها را آپلود می کنه ولی برخصی از عکسها را آپلود نمی کنه .
علت چی میتونه باشه.
مثلا هر دو عکس با یک گوشی گرفته شده ولی یکی آپلود میشه و دیگری نمیشه.
کد HTML
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebApplication1._Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <style type="text/css"> a { color: #715241; font-style: normal; text-decoration: none; font-size: 20px; } </style> </head> <body> <form id="form1" runat="server"> <div> <asp:FileUpload ID="myFileUpload1" runat="server" /> <br /> <asp:Button ID="Button1" runat="server" Text="Upload" onclick="Button1_Click" /> <br /> <!-- To display the Size of image --> <span>Size Before Resize : </span> <asp:Label ID="Label1" runat="server" Text=""></asp:Label> <br /> <span>Size After Resize : </span> <asp:Label ID="Label2" runat="server" Text=""></asp:Label> <br /> <a href="http://localhost:35525/PagesDialog/chPassword.aspx"> <asp:Image ID="imgPersonnel1" runat="server" autocomplete="off" Height="126px" ImageUrl="~/Images/PicPersonnel.png" Width="126px" /> </a> <br /> <!-- To display the Resize Image --> </div> </form> </body> </html>
کد VB.net
Public Class _Default Inherits System.Web.UI.Page Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click If Page.IsValid Then Dim oHttpPostedFile As System.Web.HttpPostedFile = myFileUpload1.PostedFile Dim y As String = Request.QueryString("C") Dim strFileName As String = System.IO.Path.GetFileName(oHttpPostedFile.FileName) Dim strRootRelativePath As String = "~/pic/" Dim strPath As String = Server.MapPath(strRootRelativePath) strFileName = "1.jpg" Dim strPathName As String = String.Format("{0}\\{1}", strPath, strFileName) oHttpPostedFile.SaveAs(strPathName) imgPersonnel1.ImageUrl = ("~/pic/" + strFileName) imgPersonnel1.ImageAlign = System.Web.UI.WebControls.ImageAlign.AbsMiddle Dim strInformationMessage As String = "! فایل با موفقیت آپلود گردید" ClientScript.RegisterStartupScript(Me.[GetType](), "alert", "alert('عکس با موفقیت آپلود گردید')", True) Return Response.Redirect(Request.Url.AbsoluteUri) End If End Sub End Class
لینک عکس مورد نظر در لینک زیر قرار دارد.
http://uplod.ir/wl0593rlvuzq/WebApplication1.zip.htm
با تشکر از شما
این پست در تاریخ {{ dateString(new Date(post.deleteDate)) }} توسط {{ post.deletedByUser }} حذف شده است.
دلیل حذف: {{ post.deleteReason ?? 'نامشخص' }}
زمان پاسخ گویی روز های شنبه الی چهارشنبه ساعت 9 الی 18
فقط به موضوعات مربوط به محصولات آموزشی و فروش پاسخ داده می شود