T O P I C R E V I E W |
MarcelG |
Posted - 23 April 2006 : 09:58:33 I've got a problem that I cannot seem to solve by myself....I need the help of someone who's got the correct skills.
Here's the scenario : Simple file upload mechanism. A single file is selected via a form, to be uploaded. Upon submit, the file is uploaded to the site, and stored in the folder site/uploaded/MemberID/filename
Now I want to enable some sort of intelligent feedback when someone tries to upload a file that already exists. The feedback would then enable a warning message plus a (previously hidden) inputfield, which defines whether or not the file should be overwritten or renamed. Meanwhile the submit button would be disabled/hidden, until the choice whether to overwrite or rename was made.
Can someone make that for me ? I can spend up to US$ 75 on it (via PayPal). The base uploading script is already available, the only thing that needs to be modified is the piece described above.
Please contact me at marcel@oxle.com for more information.< |
15 L A T E S T R E P L I E S (Newest First) |
Todd |
Posted - 07 May 2010 : 21:56:45 quote: Originally posted by Classicmotorcycling
Glad it is working for you Todd.
Thanks, me too. Makes my life easier. |
Classicmotorcycling |
Posted - 07 May 2010 : 06:24:56 Glad it is working for you Todd. |
Todd |
Posted - 06 May 2010 : 23:29:52 I used the timestamp alternative by editing the clsupload.inc file. I wasn't looking to mess with the avatar uploads, only the images that get uploaded and placed in the posts.
In the following section of that file;
'--- Get the file name --- lngPosFilename= InstrB(lngPosBoundary, strBinRequest, _ UnicodeToBinary("filename=")) if (lngPosFileName <> 0) And _ (lngPosFileName < InstrB(lngPosEnd, strBinRequest, strBinBoundary)) Then lngPosBeg = lngPosFileName + 10 lngPosEnd = InstrB(lngPosBeg, strBinRequest, UnicodeToBinary(Chr(34))) strFileName = BinaryToUnicode(MidB(strBinRequest, lngPosBeg, _ lngPosEnd - lngPosBeg))
I added the following line directly after to adjust the filename; strFileName = DateToStr(DateAdd("h", dtDateTime, strForumTimeAdjust)) & "_" & strFileName Worked fine for me. Didn't affect the avatar upload. I'll see how things go, works great so far. |
Todd |
Posted - 05 May 2010 : 21:49:33 Thanks, I'll use the timestamp method. I didn't see that before it was posted today. |
HuwR |
Posted - 04 May 2010 : 11:14:35 quote: Originally posted by Classicmotorcycling
According to the outputFile.asp (line 79) the file is saved with the current Year, Month, Day, Hour, Minute and Second at the front of the filename that is uploaded, which in my books would give it a different name each time a file is uploaded.
yep, should do, so maybe it was resolved |
Classicmotorcycling |
Posted - 04 May 2010 : 05:08:56 According to the outputFile.asp (line 79) the file is saved with the current Year, Month, Day, Hour, Minute and Second at the front of the filename that is uploaded, which in my books would give it a different name each time a file is uploaded.
filename = Year(Now) & Month(Now) & Day(Now) & Hour(Now) & Minute(Now) & Second(Now) & "_" & filename
Maybe change the line to read:
filename = DateToStr(DateAdd("h", dtDateTime, strForumTimeAdjust)) & "_" & filename
Let me know how you go. |
HuwR |
Posted - 04 May 2010 : 02:35:31 As per my previous post it is not possible to check prior to uploading the file, so the easisest thing to do would be to append the datetime stamp on the end of any filename saved, then you can't overwrite anything. |
Todd |
Posted - 03 May 2010 : 20:24:55 Hi,
I'm wondering if this has ever been resolved. I'm using proeders file attachment mod to upload photos. More and more I'm having users upload photos with filenames they have already used. It's careless on their part but I would like a way to stop them from doing this. |
AnonJr |
Posted - 03 May 2006 : 08:33:42 quote: Originally posted by HuwR
Ok, it is very simple to check if a file exists on the server using the fso, it is not possible however to check if the file you are about to upload exists because you need to post the form first before you can get at the filename, you can get at the filename using clientside javascript but you can't check if it exists on the server using clientside javascript, PHP does not have this security restriction
Way past time for me to start learning some PHP... thanks. I'm still not sure I understand the mechanics of how PHP gets the file name before you upload the file, but I'm willing to let it be ... until I get some basic PHP skills down. < |
HuwR |
Posted - 03 May 2006 : 05:40:48 some of the asp upload components may have the ability to check, although they may still do the upload first, but do it to memory rather than to disk, you could still try to integrate the php upload form in to Snitz, alternatively you could write a .net upload component which did it all for you and integrate that in to Snitz< |
MarcelG |
Posted - 03 May 2006 : 05:08:06 Well, the code I'm looking for should 'plug in' to the Snitz file attachment mod. So, ASP Upload and ASP.< |
HuwR |
Posted - 03 May 2006 : 04:15:56 why can't you just use the upload code you have at storage.oxle.com ? < |
MarcelG |
Posted - 03 May 2006 : 04:06:42 Okay...I'll just give up then. Thanks for the feedback.< |
HuwR |
Posted - 03 May 2006 : 03:49:13 MarcelG, as I said, it is the PHP doing the checking < |
MarcelG |
Posted - 03 May 2006 : 03:42:38 quote: Originally posted by HuwR
so, if you already have the answer, why are you asking the question ?
Well...sorry for trying to understand this....
I've been looking into upload.php, to see what it does when it's requested as mentioned in the red part. it then does this:
{
$files = gpc ( 'files', 'P', array() );
$folder = path_decode ( gpc ( 'folder', 'P', '' ) );
$path = $user_root . $folder . '/';
for ( $i = 0; $i < count ( $files ); ++$i )
{
if ( is_file ( $path . $files[$i] ) )
{
print parse ( $lang_upload['upl_file_exists_warn'], array ( '{file}' => htmlentities ( $files[$i] ), '{folder}' => ( $folder == '' ? $lang_misc['main_folder'] : basename ( $folder ) ) ) );
}
}
} < |
|
|