Upload file to S3 using filepicker.io and replace whitespace -
i've been uploading files amazon s3 using javascript library filepicker.io , implementation works ok, problem i'm facing when users upload files white spaces or fancy characters files not accessible through http, wondering if there way apply kind of renaming file prior uploading face.
i'm using pickandstore method filepicker.io api
filepicker.pickandstore({ mimetype: ['video/*'], services:['computer', 'dropbox', 'google_drive', 'box', 'url', 'video', 'ftp'], },{location: 's3'},function(fpfiles){ fpfile = fpfiles[0]; $('#temp_file_url').val('/' + fpfile.key); });
thanks.
you can specify "path" parameter in both filepicker.store() call , filepicker.pickandstore(), if want strip whitespace filenames keep rest same, structure be:
filepicker.pick({...options...}, function(fpfile){ var new_name = process(fpfile.filename); filepicker.store(new_name, {path: new_name, filename: new_name}, function(){}); });
Comments
Post a Comment