Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- router.post('/tagimg', authenticator.isAuthenticated, function (request, response) {
- if (isLoggedIn(request, response, true)) {
- //console.log(request);
- var form = new formidable.IncomingForm();
- form.uploadDir = app.config.media_folder + '\\akmedia\\tags\\';
- form.parse(request, (err, fields, files) => {
- if (files.pictureFile && fields.lastId) {
- console.log('Changing: ' + fields.lastId);
- var pictureFile = files.pictureFile;
- var oldpath = pictureFile.path;
- var newpath = app.config.media_folder + '\\akmedia\\tags\\' + fields.lastId + '.jpg';
- fs.rename(oldpath, newpath, (err) => {
- if (!err) {
- response.end('{"success" : "Updated Successfully", "status" : 200}');
- } else {
- console.log(err);
- response.end('{"error" : "toma no cu", "status" : 500}');
- }
- })
- } else {
- console.log('fuck');
- }
- });
- } else {
- response.end('{"error" : "toma no cu", "status" : 500}');
- }
- });
Add Comment
Please, Sign In to add comment