Struts 2 - Deleting temp files created for file upload - struts2

Struts create temp files as part of file upload . I have specified my own location (struts.multipart.saveDir) for creating the temp files. My problem is that the temp files that are getting created are not getting deleted. I was under the impression that the framework would delete the files. Is my understanding correct ? If so then mine is not working as expected. I couldn't get a proper answer any where online . Struts 2 documentation on temp directors (http://struts.apache.org/docs/file-upload.html#FileUpload-TemporaryDirectories) doesn't specify any thing either.
Can some one help figure out
Should struts frame work be deleting temp files it create as part of
upload ?
If the answer for 1 is yes, Is there some thing specific we need to
do ?
Thanks

Related

Using .zip files with Forge Design Automation for AutoCAD

I have a zip file containing several file types (.dwg,.xlsx,.pdf). If I specify a .zip file as input, I've noticed they're all accepted by Forge, but only .dwg's come back out. Is there anyway I can fix this?
Save your results to specific folder and finally create zip file.
ZipFile.CreateFromDirectory(CurrentDirectory + "\\Result", CurrentDirectory + "\\Result.zip");
This zip file set as result of your WorkItem.
Thanks to everyone who replied,
Ultimately, I create a project folder structure all my files are unzipped into (dwgs, pdfs, xlsx),beneath the working folder. My localname for both my input and result are identical in both the Activity and the Workitem. I recall Augusto telling me not to do this, but I have yet to run into an issue with it. In the end, my files get cycled in AutoCAD Core and saved to same location. DA zips the changed files and sends them to my endpoint. I took this approach, because if I save to changed files into a results folder, my modified dwg files and non-dwg files are now in two separate, adjacent locations. If there's a side affect of working with files in a single location, I'd like to know what it is.

Grails 3 web interface with zip upload via form to a folder on the server

I'm trying to create a Grails 3 web interface with an upload form that writes zip files to a folder on the server.
I have already tried a lot of plugins or solutions that can be found here but nothing seems to work.
My code can be found on github (https://github.com/rm93/BIGC).
Would anyone know a solution that I could apply?
I have found a solution to my problem. Instead to give a path to the transferTo method i now I give it a new file.
fileUpload.transferTo(new File("/path/to/folder/data.zip"))

Extract ZIP and move all files to parent directory

I'm only just getting started with Yeoman, trying to create a Generator that downloads WordPress, unzips it, and then proceeds to download my own WordPress starter theme.
The problem I'm having is that when I extract the latest.zip from wordpress.org (using this.extract()) it contains a wordpress/ directory resulting in my directory structure being my-project/wordpress/ rather than my-project/.
I've tried moving, copying and deleting the wordpress/ directory with various degrees of success; using this.fs.copy() I actually managed to get the files in the correct folder, but when trying to delete the original wordpress/ directory the user has to confirm deletion of every single file (not ideal). When I tried this.fs.move() I had to confirm each and every move instead.
I've found similar gulp/node.js questions on here, but I would prefer to use Yeoman's built in this.fs API.
Please note that I am aware of YEOPress but this is mostly for learnig purposes.
I ended up using the Node Package fs-extra instead as it deletes or moves without confirmation.

setting a destination for uploaded Images in Zend Framework 2

i am a little confused about how to set a destination for an uploaded images in zend frameowrk 2
i followed this great tutorial here
and have managed to upload my images. however, i need to upload the image to my public folder. at present i am only able to upload to a folder within the module i am working on.
i.e:
$adapter = new \Zend\File\Transfer\Adapter\Http();
$adapter->setDestination(dirname(__DIR__).'/testImage');
what is the equivalent direname(DIR) that would allow me to set the address to an alternative directory or to the directory in my public folder.
thanks in advance
Paul

How do you save file on server?

I am saving images on file and i am creating first folder which has Guid name for avoiding to duplicate file names. And entities hold reference src of image.
I feel that creating folder and giving guid name is wrong from point of performance. So how i have to avoid duplicate names ?
And second problem is the project seperated into 2 project. One is admin and other for user interface so i can not access my saved files from user interface. What is best practice about these problems ?
About the first problem, I think you could create a folder per user and replace the existing file, asking user confermation.
The second problem can be solved using a NFS or a shared directory where the admin and the user application can both read and write files (and you need to develope a component that retrieve the files and return them to your web apps).

Resources