嘿伙计们,我在如何使用 angularjs 和 flowjs 上传和保存图像时遇到了一些问题。
我是 angularjs 的新手,在尝试上传图片时遇到了问题,但我让它与 ng-flow 一起工作,但在尝试将图片保存到某个设计的路径时仍然遇到一些问题。
一个示例和类似的问题是如何以及在何处使用 ng-flow 保存上传的文件?,但我仍然无法让它工作。
这是上传和预览的代码,到目前为止运行良好:
<div class="ng-scope add-file" flow-init="{target:'../WebService/WebService.asmx/setImage'}"
flow-name="image.flow" flow-files-submitted="$flow.upload()"
flow-file-added="!!{png:1,gif:1,jpg:1,jpeg:1}[$file.getExtension()]">
<div class="row" style="margin-top: 0px!important;">
<div class="col-sm-10">
<p><label for="image">ADD PHOTO</label></p>
<table style="border: 0px;">
<tr>
<td ng-repeat="file in $flow.files" class="ng-scope thumbnail" style="margin: 3px 3px 3px 3px;">
<div class="text-right">
<a class="glyphicon glyphicon-remove" ng-click="file.cancel()"
style="color:#ff4b4b; text-decoration: none!important;"></a>
</div>
<div class="frame" ng-show="$flow.files.length" style="min-width: 210px!important;">
<span class="helper"></span>
<img flow-img="file" src="" class="image-thumbnail">
</div>
<div class="progress progress-striped" ng-class="{active: file.isUploading()}">
<div class="progress-bar" role="progressbar" aria-valuenow="100" aria-valuemin="0"
aria-valuemax="100" ng-style="{width: (file.progress() * 100) + '%'}">
</div>
<span class="sr-only ng-binding">1% Complete</span>
</div>
</td>
</tr>
</table>
</div>
<div class="col-sm-2 text-right drop" flow-drop="" ng-class="dropClass">
<span class="file-upload btn btn-primary" flow-btn="">
Choose file
<input type="file" multiple="multiple" style="visibility: hidden; position: absolute;">
</span>
</div>
</div>
但这是问题所在,我不知道如何或如何在某些路径中创建此图像...
我将我的 webservice 方法传递给 ng-flow-init,因为它将通过如下 url 参数发送:
flow-init="{target:'../WebService/WebService.asmx/setImage'}"
并且 ws 像以下示例一样接收它:
../setImage?flowChunkNumber=1&flowChunkSize=1048576&flowCurrentChunkSize=198637&flowTotalSize=198637&flowIdentifier=198637-1jpg&flowFilename=1.jpg&flowRelativePath=1.jpg&flowTotalChunks=1
'flowChunkNumber=1
'flowChunkSize=1048576
'flowCurrentChunkSize=111168
'flowTotalSize = 111168
'flowIdentifier=111168-Figura1png
'flowFilename=Figura1.png
'flowRelativePath=Figura1.png
'flowTotalChunks = 1
我应该如何处理这些信息,或者我需要什么来发送数据(二进制、base64 等)并在我的服务器上保存/创建图像?
编辑 1:我已经知道我需要文件数据,并认为我确实需要一个upload.php来转换和发送文件。仍然想不出如何为 vb.net 创建一个 upload.php