tomitrescak / meteor-uploads

MIT License
295 stars 41 forks source link

URL error #185

Open ag84ark opened 8 years ago

ag84ark commented 8 years ago

Hi,

i have used the renaming option of the package and i get this: "_id" : "b8uCD7idgGLqDDppj", "name" : "MynQ4eA6NSsKfZojp_bmw2.jpeg", "path" : "2015/10/13/MynQ4eA6NSsKfZojp_bmw2.jpeg", "size" : 8368, "type" : "image/jpeg", "subDirectory" : "2015/10/13", "baseUrl" : "http://localhost:3000/upload/", "url" : "http://localhost:3000/upload/2015/10/13/bmw2.jpeg"

the url has the image original name (upload name), while the path and name has the new and good name. Can you tell me if i did something wrong. Also posted the init function.

UploadServer.init({ tmpDir: process.env.PWD + '/.uploads/tmp', uploadDir: process.env.PWD + '/.uploads/', checkCreateDirectories: true, //create the directories for you getDirectory: function(fileInfo, formData) { var d = new Date(); return d.getFullYear() + '/' + d.getMonth() + '/' + d.getDate(); }, getFileName: function(fileInfo, formData) { return Random.id()+'_' + fileInfo.name; } });

Thanks

tomitrescak commented 8 years ago

It's a bug .. will take care of it.

Manovsky commented 8 years ago

Hi Tomi and thanks for this package. I got the same problem with autorename.

1) I upload a file named "aaa" wich contain this text : "aaa original" 2) i can get it from http://localhost:3000/upload/aaa Until there, no prob 3) i modify the aaa's text to : "aaa new" 4) i reupload this aaa file

The url on the finished is : http://localhost:3000/upload/aaa for this last file, but the real name is "aaa (1)". So when i tried to get the file by the url, i get my last file with the text "aaa orinal". To get the new one I have to write url : http://localhost:3000/upload/aaa%20(1).

Regards

tomitrescak commented 8 years ago

For now, just don't use spaces in file names please.