node.js


Rename uploaded images using MULTER


I am uploading the images using multer. They all are given random names (dec93b9f333c7a731723b06ce73c0bbc.jpg), which is very bad for SEO... Can you guys help me out, how to save the images with the pattern: 'fixed-name'+'random-name'.extension. Then at least part of the file would be readable for the google. Thanks!
app.set('images', '/var/www/images');
app.use(app.get('images'), express.static(app.get('images')));
var multerForImage = multer({
dest: app.get('images'),
onParseStart: function (file) {
console.log("Started parsing file stream", file);
},
onFileUploadStart: function (file) {
console.log('File recieved: ', file.originalname);
},
onFileUploadComplete: function (file, req, res) {
console.log("File upload complete");
var path = app.get('images') + "/" + file.name;
var user = req.session.user;
res.json({
success: true,
data: path
});
},
onFileUploadData: function (file, data, req, res) {
console.log('Data recieved for file upload');
},
onParseEnd: function (req, next) {
console.log("Parsing data end for file upload");
}
});

Related Links

electron - process.env.npm_package* variables missing
Mongoose: only show populated results
Woocommerce API Variable Subscription Product update
Alexa Skill - Keep Intent alive for dialogue
Post to google+ wall from plusDomains api
Nodemailer error connect ECONNREFUSED
Node.js not serving files other than index.html
do not run loop queue when specify argument in yeoman generator
cannot pass variables from node js to ejs page
Node.js: how to save uploaded file from browser form?
How to put flash message into my code?
Aggregate method not working as expected
Docker compose version 3 doesn't work as I expected
Ajax call in react js
How to setup an API server with no domain name
Possible collision between nodejs and angular routing

Categories

HOME
.net-core
cakephp-3.0
boost
dropzone.js
http-headers
soundcloud
spring-transactions
css-modules
playframework-2.5
visio
shoutem
video-processing
sensenet
prestashop-1.6
bit-manipulation
systemml
netbeans-7.3
mysql-error-1064
boto
touch
google-cloud-vision
silex
jqxwidgets
rubinius
akka-stream
nodemon
uppaal
android-sensors
gtm-database
python-tesseract
grunt-connect-proxy
kinvey
rcp
javabeans
tensorflow-serving
direct3d9
nsubstitute
gooddata
fitnesse-slim
3d-modelling
actor
azure-sql-server
media-type
imei
simplemodal
google-truth
rethinkdb-python
dwt
exceljs
invoke
shared-ptr
opensmtpd
graylog
docker-registry
optional
simplehttpserver
greenlets
siteminder
google-chrome-arc
cpio
powershell-tools
local-variables
express-stormpath
cscore
smart-pointers
knox-gateway
imshow
video-recording
compass
giflib
kmip
dotpeek
openoffice-writer
traceroute
ng-template
mks-integrity
jedit
webots
objdump
elmah.mvc
unexpectendoffile
nstablecolumn
aloha-editor
custom-validators
mashape
ngen
spool
resharper-plugins
control-center
form-helpers
telerik-test-studio
activator
avassetwriter
alassetslibrary
ubuntu-13.04
problem-steps-recorder
real-time-data
system.speech.recognition
backbone-forms
java-service-wrapper
iwebkit
pmp
strtotime
camping
springmockito
ctime
generic-list
twisted.internet
snk
windows-live-writer
google-notebook

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile