node.js connect-form image upload to tmp directory - file-upload

I uploading the images using connect-form and express as in https://github.com/visionmedia/express/blob/cbdd907393e6fc9cf4eb092237241d1626a9a98d/examples/multipart/app.js.
The images get saved to /tmp directory.
I want to change it from /tmp to some directory that is within the application context. How can I do this ?

You can set
req.form.uploadDir = "<your_path>";
and the file is saved in the fixed path.

You can use utils.pump to move the file to some other dir.

best is to configure uploadDir :
app.use(express.bodyParser({uploadDir:__dirname+'/uploads'}));

Related

Adding static PDF file to nuxt js project

I have a project in vue and I want to build it with Nuxt.
I have link in footer that I want user to download a PDF file by clicking on it , it works fine on local server but when I build the project I can't find the pdf file .
I stored the file in Static/documents folder
You have to put the .pdf in the static folder. Then to see you go to http://localhost:3000/yourpdf.pdf (localhost o your domain)
Perhaps you forgot to push it the server ? How your are deploying your application ? using git ? if yes check if there is files in the stage with "git status" command
Did you try to access to yourdomain.com/documents/yourfile.pdf ?

React-Native AsyncStorage for images

My app downloads images from a webserver and saves them, but I am unsure where to save them, is there a local storage for images?
Thanks
Try rn-fetch-blob
You can
create file
delete file
create directory
read file
download file

Laravel wrong public path file upload

I've deployed laravel with this guide.
http://juniorgrossi.com/deploying-laravel-applications-on-a-shared-host/
On my webserver I have a public_html file now containing all my publicly accesable files and a laravel folder containing the rest, so I've split up the default laravel structure for deployment.
On my development server by default the public folder is resting inside the laravel folder instead of being on the same directory level.
The problem I'm getting though is when I use something like this:
// Upload the file
Input::upload('image', 'public/uploads', $filename);
Same with this.
// Upload the file
Input::upload('image', path('public') . 'uploads', $filename);
Instead of trying to use the uploads folder that is inside my public_html folder it tries looking for a public file inside my laravel folder now.
And I get a
Unable to create the "/uploads" directory
Ofcourse on my development server the public folder is still inside the folder so it's logical.
How do I fix this?
You may try this (add a slash after the folder name)
Input::upload('image', path('public') . 'uploads/', $filename);
Maybe try this....just as a test
Input::upload('image', URL::to_asset('uploads/'), $filename);
You can also try
Intervention/image package.
I'm using this and I find it very easy to use. It also has a resize and crop feature.
It's easy as:
Image::make(Input::file('file')->getRealPath())->save('uploads/' . $filename);
Fixed the paths.php to ../public_html
I've done this before but it failed since I accidentaly uploaded a png and my jcrop function wich crops and saves images failed because it currently onlt takes jpg. So that left me thinking my paths.php settings were no good while they actually were.
Thanks for helping out though everybody!
(I feel like a fool.)
In my case, I got the same problem. Then I created it manually, CHMODed the lil' bastard and it worked fine!
Making a long history short (not so long...): just permission!
If you have the permission to Write/Read to the folder, you'll be cool! If you don't, you change the permissions! If you are unable to change it, put the uploaded files where the permissions allows you to access the file.

Yii - How to cause Yii to republish to the assets folder

Yii question.
On my development machine, the required JQuery files for the application were present in a subfolder under the assets folder. However, when I copied the application to my test server, JQuery files were missing in the folder yii looked for them. I kept getting errors such as '../assets/db0e5a94/jquery.ba-bbq.js' 404 not found, etc.
I emptied the assets folder, and now all my CSS files etc. are reported missing. Is there any way I can cause Yii to republish to the assets folder?
Thanks!
Simply delete all sub-directories in the assets folder and clear your browser cache. Do not delete the assets directory or you will have to set the write permissions again.
in components/Controller.php add the following function:
protected function beforeAction($action){
if(defined('YII_DEBUG') && YII_DEBUG){
Yii::app()->assetManager->forceCopy = true;
}
return parent::beforeAction($action);
}
A simple way to have your assets back is to manually copy them from framework directory back. I know it is not the best way to do it, but it should help you while you find a better solution.
Ask your hosting service provider to disable SAFE_MODE in php.ini. Then remove asstes directory together with its sub files and folders and create it again. Make sure that you set CHMOD to 0777 for the new directory you just created.
I also had this same problem. After uploading the respective files to the server i changed the file permission to 755 in the server. Then it worked.

File upload in specific folder of web application in liferay..?

I am using liferay 6.0.5. I am uploading file using following code.
UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest);
String submissionFileName = uploadRequest.getFileName("file");//uploaded filename
File submissionFile = uploadRequest.getFile("file");
this works fine and upload file in tomcat's temp directory with some different name. What I want is.."There is one folder docs in my project directory. I want uploaded file in this directory". How to do this in liferay..?
If you want to change the temp directory for the file upload then you can change the following property in portal-ext.properties:
com.liferay.portal.upload.UploadServletRequestImpl.temp.dir=C:/MyTempDir
Hope this is what you are looking for.
If you want to add files to Liferay's Document Library then check out the following classes:
http://docs.liferay.com/portal/6.0/javadocs/com/liferay/portlet/documentlibrary/service/DLFileEntryLocalServiceUtil.html
http://docs.liferay.com/portal/6.0/javadocs/com/liferay/portlet/documentlibrary/service/DLFolderLocalServiceUtil.html