1
클라이언트 측에서 이미지의 크기를 조정할 수있는 옵션이 있으므로 Plupload 플러그인을 사용하여 여러 이미지를 업로드하고 있으며 원본 크기로 이미지를 업로드하여 별도의 폴더에 저장하고 싶습니다. 다른 폴더로 크기가 조정 된 이미지.plupload를 사용하여 서로 다른 두 가지 크기의 이미지 저장 방법
아무도 나에게 더 procee하는 방법을 제안 할 수 있습니까? 여기 내 코드입니다 :
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
Dim chunk As Integer = If(context.Request("chunk") IsNot Nothing, Integer.Parse(context.Request("chunk")), 0)
Dim fileName As String = If(context.Request("name") IsNot Nothing, context.Request("name"), String.Empty)
Dim fileUpload As HttpPostedFile = context.Request.Files(0)
Dim uploadPath = context.Server.MapPath("~/uploads")
Using fs = New FileStream(Path.Combine(uploadPath, fileName), If(chunk = 0, FileMode.Create, FileMode.Append))
Dim buffer = New Byte(fileUpload.InputStream.Length - 1) {}
fileUpload.InputStream.Read(buffer, 0, buffer.Length)
fs.Write(buffer, 0, buffer.Length)
End Using
context.Response.ContentType = "text/plain"
context.Response.Write("Success")
End Sub
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property
이 내 스크립트 코드 :
<script type="text/javascript">
$(function() {
// Setup flash version
$("#flash_uploader").pluploadQueue({
// General settings
runtimes: 'flash',
url: 'upload.ashx',
max_file_size: '10mb',
chunk_size: '1mb',
unique_names: true,
filters: [
{ title: "Image files", extensions: "jpg" }
],
// Resize images on clientside if we can
resize: { width: 800, height: 600, quality: 90 },
// Flash settings
flash_swf_url: 'js/plupload.flash.swf',
init: { StateChanged: function (up) {
// Called when the state of the queue is changed
if (up.state == plupload.STOPPED) {
$("#btnSubmit").removeAttr("disabled");
}
}
}
});
var uploader = $('#flash_uploader').pluploadQueue();
uploader.bind('FileUploaded', function (up, file, res) {
$('#showfilelist').append("<div id=" + file.id + "><a href='uploads/" + file.target_name + "' target='_blank'><img src='uploads/" + file.target_name + "' border='0'/><br>" + file.name + "</a><br>(" + plupload.formatSize(file.size) + ") <span></span></div>");
});
});
</script>
감사를 저장 경로에서 액세스 할 수 있습니다 실제로 이것은 핸들러이며 우리는 위와 같이 처리 할 수 없으므로 위의 핸들러에이 코드를 추가 할 수 있습니다. – coder