Tag: 图像上传

将图像文件数据从前端发送到后端

有没有一种方法可以将图像文件从前端发送到后端? 我需要将表单中选定的图像上传到云计算云平台。 用req.body访问文件input没有帮助,并给我一个错误,说no such file or directory open 。 如果我添加enctype="multipart/form-data" ,然后在我的后端做一个req.on('data', (data)=> {console.log(data.toString)}) ,然后执行上传它cloudinary,它失败,并给我以下错误: Error: Path must be a string without null bytes 这是我的forms: <form method="post" action="/submitArticle" enctype="multipart/form-data"> <div class="file"> <label class="file-label"> <input class="file-input" type="file" name="image"> <span class="file-cta"> <span class="file-icon"> <i class="fa fa-upload"></i> </span> <span class="file-label"> Choose a file… </span> </span> </label> </div> <div class="field"> […]

在服务器端支持图片上传吗?

我正在尝试创build一个REST API服务器,可以接受图像上传与node.js restify。 我查看了http://restify.com/上的文档,但无法确定restify是否支持将图像上载为服务器。 在服务器端支持图片上传吗? 如果不是,哪个node.js模块可以用来做图像上传服务器?

在哪里存储凭据?

我正在构build一个包含图像上传function的应用程序,并决定使用Aws S3作为文件存储服务。 为了将图像上传到aws s3,您需要为该服务提供具有凭据的API。 为了保证这些证书的安全,我决定将它们存储在我自己的服务器上,并且只在需要上载图像时才将它们提供给客户端。 以下是我上传图片的过程: 1)客户端从相机胶卷select图像并点击上传button 2)该应用程序向我自己的服务器发出请求,并通过图像托pipe服务的访问密钥(aws s3) 3)客户端现在可以上传图片到aws s3。 上传完成后,客户端将删除证书。 我的问题是: 1)这样做是否安全? – 有没有更好的方法来处理这个问题? 2)我应该在哪里存储凭据在我的服务器,以保持他们的安全? 我的意思是我应该将它们存储在一个文件,数据库,代码中? *我使用graphql / expressjs作为后端,并将本机作为前端进行响应。

用Angularjs上传图片

当我在模块中添加“ngFileUpload”时出现错误。 我用过 var app = angular.module('myApp', ['ngFileUpload']); 并在路由页面: angular.module('myApp') .config(function ($stateProvider) { $stateProvider .state('dashboard', { url: '/dashboard', templateUrl: 'app/dashboard/dashboard.html', controller: 'DashboardCtrl' }) }); 错误是: Error: [$injector:modulerr] Failed to instantiate module umxApp due to: [$injector:unpr] Unknown provider: $stateProvider http://errors.angularjs.org/1.4.1/$injector/unpr?p0=%24stateProvider minErr/<@http://localhost:9000/bower_components/angular/angular.js:68:12 createInjector/providerCache.$injector<@http://localhost:9000/bower_components/angular/angular.js:4255:19 getService@http://localhost:9000/bower_components/angular/angular.js:4402:39 invoke@http://localhost:9000/bower_components/angular/angular.js:4434:1 runInvokeQueue@http://localhost:9000/bower_components/angular/angular.js:4349:11 loadModules/<@http://localhost:9000/bower_components/angular/angular.js:4358:11 forEach@http://localhost:9000/bower_components/angular/angular.js:336:11 loadModules@http://localhost:9000/bower_components/angular/angular.js:4339:5 createInjector@http://localhost:9000/bower_components/angular/angular.js:4265:11 bootstrap/doBootstrap@http://localhost:9000/bower_components/angular/angular.js:1621:20 bootstrap@http://localhost:9000/bower_components/angular/angular.js:1642:1 angularInit@http://localhost:9000/bower_components/angular/angular.js:1536:5 @http://localhost:9000/bower_components/angular/angular.js:28289:5 jQuery.Callbacks/fire@http://localhost:9000/bower_components/jquery/dist/jquery.js:3099:10 jQuery.Callbacks/self.fireWith@http://localhost:9000/bower_components/jquery/dist/jquery.js:3211:7 .ready@http://localhost:9000/bower_components/jquery/dist/jquery.js:3417:1 completed@http://localhost:9000/bower_components/jquery/dist/jquery.js:3433:2 […]

在节点中结合multer和tinypng API

有谁知道如何使用MULTER使用tinyPNG的API ? 这些文件似乎看似简单: var source = tinify.fromFile("unoptimized.jpg"); source.toFile("optimized.jpg"); 虽然没有明确的迹象表明这将是什么意思去,特别是在这样一个令人费解的事情: var storage = multer.diskStorage( { destination: function (req, file, callback) { callback(null, './uploads'); }, filename: function (req, file, callback) { //use date to guarantee name uniqueness callback(null, file.originalname + '-' + Date.now()); } } ); //.any() allows multiple file uploads var upload = multer({ storage : […]

使用多方将图像从ipad app上传到节点js服务器

我是非常新的JavaScript和节点js。 我正在从我的iPad应用程序上传图像,以使用多方模块来rest节点js(快速js)的api。 这是我在目标c中的图像上传代码。 NSData *imgData = UIImageJPEGRepresentation(img.image, 0.2); NSString *urlString = @"http://localhost:3000/api/uploadimage"; NSString *str = @"displayImage"; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; [request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData]; [request setHTTPShouldHandleCookies:NO]; [request setTimeoutInterval:30]; [request setURL:[NSURL URLWithString:urlString]]; [request setHTTPMethod:@"POST"]; NSString *boundary = [NSString stringWithFormat:@"—————————14737809831464368775746641449"]; NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary]; [request setValue:contentType forHTTPHeaderField: @"Content-Type"]; NSMutableData *body = [NSMutableData data]; [body […]

产卵ENOENT错误

我正在尝试使用imager模块将东西上传到亚马逊S3。 我不断收到错误消息说, events.js:72 throw er; // Unhandled 'error' event ^ Error: spawn ENOENT at errnoException (child_process.js:980:11) at Process.ChildProcess._handle.onexit (child_process.js:771:34) 我已经在我的电脑上安装了imagemagick,但是它一直说它没有链接,这可能是问题吗? 我也尝试使用brew链接imagemagick链接,但由于某种原因无法链接。 我正在使用OSx。 任何修复? 谢谢。