arvindr21 / blueimp-file-upload-expressjs

A simple express module for integrating jQuery File Upload.
http://expressjs-fileupload.cloudno.de/
104 stars 69 forks source link

Can't Read the image back #37

Closed djyadav closed 9 years ago

djyadav commented 9 years ago

Images are uploaded well but cant read them back via url. Any one got through the same problem or have any idea about the mis configuration. (Using ExpressJs )

var options = { tmpDir: dirname + '/public/uploaded/tmp', uploadDir: dirname + '/public/uploaded/files', uploadUrl: '/uploaded/files/', maxPostSize: 11000000000, // 11 GB minFileSize: 1, maxFileSize: 10000000000, // 10 GB acceptFileTypes: /.+/i, // Files not matched by this regular expression force a download dialog, // to prevent executing any scripts in the context of the service domain: inlineFileTypes: /.(gif|jpe?g|png)/i, imageTypes: /.(gif|jpe?g|png)/i, copyImgAsThumb : true, // required imageVersions :{ maxWidth : 200, maxHeight : 200 }, accessControl: { allowOrigin: '*', allowMethods: 'OPTIONS, HEAD, GET, POST, PUT, DELETE', allowHeaders: 'Content-Type, Content-Range, Content-Disposition' }, storage : { type : 'local', aws : { accessKeyId : 'xxxxxxxxxxxxxxxxx', secretAccessKey : 'xxxxxxxxxxxxxxxxx', region : 'us-east-1',//make sure you know the region, else leave this option out bucketName : 'xxxxxxxxxxxxxxxxx' } } };

app.get('/upload', function(req, res) {
  uploader.get(req, res, function (obj) {
        res.send(JSON.stringify(obj)); 
  });

});

app.post('/upload', function(req, res) {
  uploader.post(req, res, function (obj) {
        res.send(JSON.stringify(obj)); 
  });

});

// the path SHOULD match options.uploadUrl 
app.get('/uploaded/files/:name', function(req, res) {
  uploader.get(req, res, function (obj) {
        res.send(JSON.stringify(obj)); 
  });

});
app.delete('/uploaded/files/:name', function(req, res) {
  uploader.delete(req, res, function (obj) {
        res.send(JSON.stringify(obj)); 
  });

});