mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-22 08:20:36 +01:00
image upload changes
This commit is contained in:
@@ -4,6 +4,13 @@ var config = {
|
||||
|
||||
// "base_url" is expected to be a publically accessible URL to your NodeBB instance (Default base_url: 'http://localhost', port: '4567')
|
||||
"base_url": "http://localhost",
|
||||
|
||||
// public url for uploaded files
|
||||
"upload_url": "http://dev.domain.com/uploads/",
|
||||
|
||||
// relative path for uploads
|
||||
"upload_path": "/uploads/",
|
||||
|
||||
"use_port": true,
|
||||
"port": 4567,
|
||||
|
||||
|
||||
@@ -198,11 +198,8 @@ $(document).ready(function() {
|
||||
hideAlerts();
|
||||
$('#alert-error').text(message).show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
(function() {
|
||||
|
||||
function submitUserData() {
|
||||
var userData = {
|
||||
uid:$('#inputUID').val(),
|
||||
@@ -236,8 +233,6 @@ $(document).ready(function() {
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
var selectedImageType = '';
|
||||
|
||||
$('#submitBtn').on('click',function(){
|
||||
@@ -323,6 +318,7 @@ $(document).ready(function() {
|
||||
|
||||
$('#change-picture-modal').modal('hide');
|
||||
$('#upload-picture-modal').modal('show');
|
||||
hideAlerts();
|
||||
|
||||
$('#pictureUploadSubmitBtn').on('click', function() {
|
||||
$('#uploadForm').submit();
|
||||
@@ -331,6 +327,6 @@ $(document).ready(function() {
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
}());
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -241,11 +241,14 @@ var express = require('express'),
|
||||
return;
|
||||
}
|
||||
|
||||
var uploadPath = config['upload_path'] + uid + '-' + filename;
|
||||
filename = uid + '-' + filename
|
||||
var uploadPath = config.upload_path + filename;
|
||||
|
||||
console.log(uploadPath);
|
||||
|
||||
fs.rename(
|
||||
tempPath,
|
||||
global.configuration['ROOT_DIRECTORY']+ uploadPath,
|
||||
global.configuration['ROOT_DIRECTORY'] + uploadPath,
|
||||
function(error) {
|
||||
if(error) {
|
||||
res.send({
|
||||
@@ -254,7 +257,7 @@ var express = require('express'),
|
||||
return;
|
||||
}
|
||||
|
||||
var imageUrl = config.base_url + config.install_path + uploadPath;
|
||||
var imageUrl = config.upload_url + filename;
|
||||
|
||||
res.send({
|
||||
path: imageUrl
|
||||
|
||||
Reference in New Issue
Block a user