How to upload file ,create new folder using ssh_connent function php? - file-upload

How to upload file, create new folder using ssh_connent function php.
get.php file uploaded http://xxxx.com/demo/review/
But the review folder doesn't exist on the xxxx.com. I want to create review folder then upload the get.php file.

See ssh2_ftp function manual:
http://php.net/manual/en/function.ssh2-sftp.php

Related

VBA-How to convert a local path of a file in a folder managed by Drive File Stream into an URL

My goal is to create an xls sheet containing a list of files (file name + link to the file) contained in a folder.
This folder is a GDrive synchronized folder (using Drive File Stream)
I have a VBA macro which is producing this list of files but the link is a local link (G:...) and not an URL link (https://drive.google.com/...) that can be used outside my computer.
Here is an exemple
Let say I have a file in my "Drive File Stream" folder like this one:
G:\Team Drives\Test\my_file.txt
How to convert this path (using excel vba) into a GDrive's URL:
https://drive.google.com/file/d/FILE_ID/edit?usp=sharing
Another way to ask is how to get the file_id from a local path?

Download the .exe file instead of .htm file

My website has an option of downloading a .exe file. I uploaded this .exe file in dropbox and use the shared link in my website for the users to download the file.
I use href in my index.php page to create a link to that file:
<a href="https://www.dropbox.com/s/........./File.exe?dl=0" download="File">
But when users click that link in my website it downloads the .htm file. The users need to click this .htm file again which then leads to the download of the .exe file. At times users also get the error "There was an error downloading your file." while downloading the file from dropbox. I would like to know how to get the link to download the .exe file directly. Thanks!!!
When you use ?d1=0 at the end of your file path it will show the file in a preview page. Try changing it to ?dl=1to force the download.
https://www.dropbox.com/help/desktop-web/force-download

save pdf file in a folder using mPDF

I am using mPDF to generate pdfs. I want to know, how to save that file to a particular folder path. I am using this code to save the file :
$path = "sites/default/files/diet_plans/diet_plan.pdf";
$mpdf = new mPDF();
$mpdf->WriteHTML('<p>Hello</p>');
$mpdf->Output($path, "F");
exit;
But this piece of code returns an error like this :
mPDF error: Unable to create output file: sites/default/files/diet_plans/diet_plan.pdf
I have found that mPDF can not create directories. I have been using Rules to create the directory first and then execute the mPDF action. Make sure that the Directory diet_plans exists

How to use created sub folder in public folder on Play Framework 2.2.x

I created "xlsfiles" subfolder in public folder, and I used it folder for create xls file by request.
And when user send request to server to get this xls file I serve this file to client.
When I run project on Dev Mode all working perfectly, but when I run project on Production Mode not exist "xlsfiles" subfolder and I get "FileNotFoundException" exception.
Have any solution? How to make create sub folder in the project and create file in it?
Use Files class from standard Play framework API:
http://www.playframework.com/documentation/2.2.x/api/scala/index.html#play.api.libs.Files$

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