FileUpload overwrite
-
- Posts: 92
- Joined: 30 Mar 2011, 22:57
Is there any way to check if a file already exists before upload? Otherwise is this can a issue? Otherwise this could become a primefaces issue?
PrimeFaces 7.0.8 | Payara 5 | Mojarra 2.4.x
Ubuntu, Firefox
Ubuntu, Firefox
- andyba
- Expert Member
- Posts: 2473
- Joined: 31 Mar 2011, 16:27
- Location: Steinfeld, near Bremen/Osnabrück, DE
- Contact:
The temporary files which fileupload generates are guaranteed to have unique names. You need to actually save this temp file yourself using the event handler so you can check for such problems yourself.danilo.magrini wrote:Is there any way to check if a file already exists before upload? Otherwise is this can a issue? Otherwise this could become a primefaces issue?
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now
-
- Posts: 92
- Joined: 30 Mar 2011, 22:57
Hi @andyba, thx for reply!
Do I have to wait upload the file (e.g. 500 Mb) to then check for duplicate name? This is infeasible!
Do I have to wait upload the file (e.g. 500 Mb) to then check for duplicate name? This is infeasible!
PrimeFaces 7.0.8 | Payara 5 | Mojarra 2.4.x
Ubuntu, Firefox
Ubuntu, Firefox
- andyba
- Expert Member
- Posts: 2473
- Joined: 31 Mar 2011, 16:27
- Location: Steinfeld, near Bremen/Osnabrück, DE
- Contact:
This can depend on the Browser but in practice the file upload event is only called when the file has been uploaded so, yes you would normally have to wait .danilo.magrini wrote:Hi @andyba, thx for reply!
Do I have to wait upload the file (e.g. 500 Mb) to then check for duplicate name? This is infeasible!
Why not try it and see what happens?
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now
- bruno.neves
- Posts: 22
- Joined: 15 Jul 2010, 14:03
This problem happens to me too!
Checking through the FileUpload if the file is already in the folder?
Checking through the FileUpload if the file is already in the folder?
Primefaces 3.4.2
Mojarra 2.1.7
Glassfish 3.1.2
Netbeans 7.1.1
Mojarra 2.1.7
Glassfish 3.1.2
Netbeans 7.1.1
-
- Posts: 92
- Joined: 30 Mar 2011, 22:57
I've tried. So I posted on the forum. Anyway, thx for now!andyba wrote: This can depend on the Browser but in practice the file upload event is only called when the file has been uploaded so, yes you would normally have to wait .
Why not try it and see what happens?
PrimeFaces 7.0.8 | Payara 5 | Mojarra 2.4.x
Ubuntu, Firefox
Ubuntu, Firefox
Description, in this case a file name, shouldn't be a discrimination to skip a process or store data.
Having this in mind, you should agree with PF uploading the file in your temporary directory and renaming it with a unique name.
What you should do is having a kind of md5-checksum, but still, you can do this, obviously, after the file was uploaded.
Cheers,
Luigi
Having this in mind, you should agree with PF uploading the file in your temporary directory and renaming it with a unique name.
What you should do is having a kind of md5-checksum, but still, you can do this, obviously, after the file was uploaded.
Cheers,
Luigi
-
- Information
-
Who is online
Users browsing this forum: No registered users and 54 guests