Merge branch 'thierry' of ssh://git.marbelium.com:10023/Viiciouss/Sup_File into anis

This commit is contained in:
Viiciouss 2018-05-08 23:28:49 +02:00
commit 1fa02b42d8
3 changed files with 23 additions and 5 deletions

5
app.js
View File

@ -13,7 +13,7 @@ var app = express();
//DB //DB
//file //file
var upload = require("express-fileupload") var upload = require("express-fileupload");
//var morgan = require('morgan'); //var morgan = require('morgan');
var mongoose = require('mongoose'); var mongoose = require('mongoose');
var passport = require('passport'); var passport = require('passport');
@ -35,7 +35,8 @@ app.use(bodyParser.json());
app.use(bodyParser.urlencoded({'extended':'false'})); app.use(bodyParser.urlencoded({'extended':'false'}));
app.use(express.static(path.join(__dirname, 'dist'))); app.use(express.static(path.join(__dirname, 'dist')));
//bizarrr //bizarrr
app.use('/public',express.static(path.join(__dirname, '../public')));
app.use('/public',express.static(path.join(__dirname, './public')));
app.use('/books', express.static(path.join(__dirname, 'dist'))); app.use('/books', express.static(path.join(__dirname, 'dist')));
app.use('/api', api); app.use('/api', api);

View File

@ -126,7 +126,7 @@ const storage = multer.diskStorage({
}); });
//post qui va stocker la photo du user ajoute dans le register , multer permet de definir le dossier serveur dans lequel seront stockes les photos //post qui va stocker la photo du user ajoute dans le register , multer permet de definir le dossier serveur dans lequel seront stockes les photos
router.post('/upload' , multer({storage: storage}).array("public[]", 12) ,function(req,res,next){ router.post('/upload' , multer({storage: storage, limits: {fileSize: 30000000000}}).array("public[]", 12) ,function(req,res,next){
console.log("req.files[0].fieldname: "+req.files[0].fieldname);//ok console.log("req.files[0].fieldname: "+req.files[0].fieldname);//ok
console.log("req.files[0].originalname: "+req.files[0].originalname);//ok console.log("req.files[0].originalname: "+req.files[0].originalname);//ok

View File

@ -24,13 +24,30 @@
<td>{{ file.name }}</td> <td>{{ file.name }}</td>
<td>{{ file.taille / ( 1024 * 1024 ) | number : '1.2-2'}} Mo</td> <td>{{ file.taille / ( 1024 * 1024 ) | number : '1.2-2'}} Mo</td>
<td>{{ file.extention }}</td> <td>{{ file.extention }}</td>
<td>{{ file.path }}</td> <td>{{ file.lastDate }}</td>
<div *ngIf="file.extention === ('image/jpeg')">
<img src="../../../{{ file.path }}" class="img-fluid flex-center" width="150" height="150">
</div>
<div *ngIf="file.extention === ('image/png')">
<img src="../../../{{ file.path }}" class="img-fluid flex-center" width="150" height="150">
</div>
<div *ngIf="file.extention === ('application/pdf')">
<i class="fa fa-file-pdf-o" aria-hidden="true"></i>
</div>
<div *ngIf="file.extention === ('video/mp4')">
<i class="fa fa-file-movie-o" aria-hidden="true"></i>
</div>
<div *ngIf="file.extention === ('text/plain')">
<i class="fa fa-file-text-o" aria-hidden="true"></i>
</div>
<div *ngIf="file.extention === ('audio/mpeg')">
<i class="fa fa-file-audio-o" aria-hidden="true"></i>
</div>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<img src="../../../public/23460.jpg" class="img-fluid flex-center">
<!-- <!--