You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by fachhoch <fa...@gmail.com> on 2010/12/22 04:00:00 UTC
saving uploaded file to temp folder best practices
I am want to save the uploaded file in temp folder till its persisted in
database along with some other fields.
I have a page with a form and a uploadpanel which is ajaxfileupload.
User 1 open this page uploaded a file with name test.pdf and filing up
other fields in the form.
at this time user2 with a different session opens this page and uploaded
the file with the same name .
uploaded files are saved to java.io.temp here is my upload folder
uploadFolder = new Folder(System.getProperty("java.io.tmpdir"),
"wicket-uploads");
uploadFolder.mkdirs();
so in my case user2 has replaced the file uploaded by user1, now when user1
persists the file and other fields to database he is persisting wrong file
.
Please suggest me what is the best practice to handle such situations ,
best practice to save files to temp folder in multi threaded application ?
I thought of using a database sequence.nextval as appender to filename so
that I uniquely identify the file, please suggest best practice ?
a user open my page uploaded file
my concern is suppose user uploads a file with filename
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/saving-uploaded-file-to-temp-folder-best-practices-tp3160036p3160036.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: saving uploaded file to temp folder best practices
Posted by fachhoch <fa...@gmail.com>.
I tested and it replaced the file.I saw the temp folder, the filename was the
same what the user uploads.
User1 file was replaced by user2 file.
when user1 saved the file it saved the wrong file.
Please suggest me solution for this ?
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/saving-uploaded-file-to-temp-folder-best-practices-tp3160036p3160839.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: saving uploaded file to temp folder best practices
Posted by James Carman <ja...@carmanconsulting.com>.
Why don't you try an upload and see what the file name is in the temp folder.
On Tue, Dec 21, 2010 at 11:18 PM, fachhoch <fa...@gmail.com> wrote:
>
> No i have not tried yet , I will try it , but this is what should happen
> right ?
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/saving-uploaded-file-to-temp-folder-best-practices-tp3160036p3160091.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: saving uploaded file to temp folder best practices
Posted by fachhoch <fa...@gmail.com>.
No i have not tried yet , I will try it , but this is what should happen
right ?
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/saving-uploaded-file-to-temp-folder-best-practices-tp3160036p3160091.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: saving uploaded file to temp folder best practices
Posted by James Carman <ja...@carmanconsulting.com>.
Have you verified that this is what happens?
On Dec 21, 2010 10:00 PM, "fachhoch" <fa...@gmail.com> wrote:
>
> I am want to save the uploaded file in temp folder till its persisted in
> database along with some other fields.
> I have a page with a form and a uploadpanel which is ajaxfileupload.
> User 1 open this page uploaded a file with name test.pdf and filing up
> other fields in the form.
> at this time user2 with a different session opens this page and uploaded
> the file with the same name .
>
> uploaded files are saved to java.io.temp here is my upload folder
>
>
> uploadFolder = new Folder(System.getProperty("java.io.tmpdir"),
> "wicket-uploads");
> uploadFolder.mkdirs();
>
>
>
> so in my case user2 has replaced the file uploaded by user1, now when
user1
> persists the file and other fields to database he is persisting wrong file
> .
> Please suggest me what is the best practice to handle such situations ,
> best practice to save files to temp folder in multi threaded application ?
>
> I thought of using a database sequence.nextval as appender to filename so
> that I uniquely identify the file, please suggest best practice ?
>
>
>
>
>
>
>
>
>
> a user open my page uploaded file
> my concern is suppose user uploads a file with filename
> --
> View this message in context:
http://apache-wicket.1842946.n4.nabble.com/saving-uploaded-file-to-temp-folder-best-practices-tp3160036p3160036.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>