WinCE OS로 고전적인 ASP 작업 중입니다. WinCE에서 파일을 업로드하고 로컬 컴퓨터에 저장하고 싶습니다. 포함 파일에 넣을 수있는 파일 업로드에 필요한 JScript 함수를 공유하십시오. 고맙습니다.버튼에 파일 업로드 asp로 클릭하십시오
답변
더 나은 방법은 여기
파일 업로드 예입니다 .. jQuery를 같은 .. 자바 스크립트 라이브러리를 사용하는 것입니다 ..http://pixelcone.com/jquery/ajax-file-upload-script/
How can I upload files asynchronously?
건배 :)
WinCE OS 및 고전 ASP에서와 같이 JQuery 플러그인을 사용할 수 없습니다. 다른 방법을 제안하십시오. – user1409360
당신은 순수한 자바 스크립트 솔루션이 필요합니까? – dhroove
예. 도와주세요. 고맙습니다. – user1409360
asp 고전에 대한 정보가 없지만 Asp.net을 사용했고 asp를 사용하여 파일을 받아서 uplo 질겁 사용에서 광고 파일은 C#을 사용하여 응용 프로그램을 개발할 수 있습니다 여기에 예제입니다.
는 그것의 클라이언트 주춤 응용 프로그램 코드의 기능 업로드 (문자열 경로, 문자열 파일 이름) 파일 경로를 소요하고 당신이 파일이 스크립트를 사용하여 업로드 처리 할 수 있습니다 페이지의#region Upload
public bool Upload(string FilePath, string FileName)
{
string Url = "HTTP://test.mtsonweb.com/fileupload.ashx"; // Change it to your page name
string BytesConfirmedReceived = "";
int BytesSent = 0;
bool Ret = false;
ASCIIEncoding encoding = new ASCIIEncoding();
try
{
if (File.Exists(FilePath +"\\"+ FileName) == false) { return true; }
//FileInfo oInfo = new FileInfo(FilePath + "\\" + FileName);
//BytesSent = Convert.ToInt32(oInfo.Length.ToString());
Url += "?myfile=" + FileName.Trim();
FileStream fr = new FileStream(FilePath + "\\" + FileName, FileMode.Open);
BinaryReader r = new BinaryReader(fr);
byte[] FileContents = r.ReadBytes((int)fr.Length);
BytesSent = FileContents.Length;
r.Close();
fr.Close();
WebRequest oRequest = WebRequest.Create(Url);
oRequest.Method = "POST";
oRequest.Timeout = 15000;
oRequest.ContentLength = FileContents.Length;
Stream oStream = oRequest.GetRequestStream();
BinaryWriter oWriter = new BinaryWriter(oStream);
oWriter.Write(FileContents);
oWriter.Close();
oStream.Close();
WebResponse oResponse = oRequest.GetResponse();
BytesConfirmedReceived = new StreamReader(oResponse.GetResponseStream(),
Encoding.Default).ReadToEnd();
oResponse.Close();
if (BytesSent.ToString() == BytesConfirmedReceived.Trim())
{
Ret = true;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return Ret;
}
#endregion
이제 웹 페이지에 입력 및 우편으로 파일 이름 당신이 원하는대로, 나는 백 엔드로 C# asp.net을 사용하고 아래 페이지 소스 :
<%@ WebHandler Language="C#" Class="FileUpload" %>
using System;
using System.Xml;
using System.Data;
using System.Web;
using System.IO;
using System.Text;
using System.Runtime.InteropServices;
using System.Drawing;
public class FileUpload : IHttpHandler
{
public void ProcessRequest(HttpContext oContext)
{
int BytesSent = 0;
//string LocalPath = @"C:\Inetpub\wwwroot\";
string MyFile = "";
try
{
MyFile = oContext.Request["myfile"].ToString().Trim();
MyFile = HttpContext.Current.Server.MapPath("~/Demo/Files/" +
ASCIIEncoding encoding = new ASCIIEncoding();
BytesSent = oContext.Request.TotalBytes;
Class1 obj = Class1.GetInstance();
obj.FileName = MyFile;
obj.FileLength = BytesSent;
byte[] InComingBinaryArray =
oContext.Request.BinaryRead(oContext.Request.TotalBytes);
obj.Data = InComingBinaryArray;
if (File.Exists(MyFile) == true)
{
File.Delete(MyFile);
}
FileStream fs = new FileStream(MyFile, FileMode.CreateNew);
BinaryWriter w = new BinaryWriter(fs);
w.Write(InComingBinaryArray);
w.Close();
fs.Close();
FileInfo oInfo = new FileInfo(MyFile);
long a = (long)BytesSent;
oContext.Response.Write(oInfo.Length.ToString());
}
catch (Exception err) { oContext.Response.Write(err.Message); }
}
public bool IsReusable { get { return true; } }
}
- 1. IIS 5.1에 ASP로 업로드
- 2. 버튼에 콘텐츠 추가 wpf로 클릭하십시오
- 3. 업로드 할 이미지를 클릭하십시오.
- 4. asp로 파일을 업로드 할 수 없습니다 : FileUpload
- 5. HTML 동적 버튼에 대한 이벤트를 클릭하십시오.
- 6. asp.net에서 파일 업로드 컨트롤을 실행하는 버튼의 이벤트를 클릭하십시오.
- 7. 첨부 파일 필드를 기본 ASP로 사용
- 8. 기본 ASP로 전체 XML 파일 작성
- 9. 파일 업로드, jQuery를
- 10. IE 업로드 사용자가 파일 업로드 입력을 차단합니다.
- 11. PHP를 ASP로 변환 하시겠습니까?
- 12. Symfony2 : 파일 업로드 플러그인을 사용하여 파일 업로드
- 13. 풍부한 : 파일 업로드 : 파일 업로드 ViewExpiredException
- 14. PHP 컬 파일 업로드 버튼이있는 파일 업로드
- 15. 파일 업로드 파일
- 16. 사용자 파일 업로드 파일
- 17. 파일 서버에 파일 업로드
- 18. asp로 Excel 매크로를 실행 하시겠습니까?
- 19. 업로드 파일
- 20. 파일 업로드?
- 21. 파일 업로드
- 22. 파일 업로드
- 23. 파일 업로드
- 24. 파일 업로드
- 25. 파일 업로드
- 26. 파일 업로드
- 27. 파일 업로드
- 28. AJAX 모달 윈도우에서 파일 업로드
- 29. 파일 업로드 버튼의 크기 조정
- 30. HTML 여러 파일 업로드 대기열
Derek를 상기시켜 주셔서 감사합니다, 나는 대답을 수락했습니다. 이제 파일 업로드를 도와주세요. – user1409360
나는 더 많은 사람들이 당신을 도울 수 있도록 질문을 upvoted. –