Upload mod ; check if file exists - Posted (4823 Views)
Retired Support Moderator
MarcelG
Posts: 2625
2625
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.<
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
New Member
Todd
Posts: 63
63
Thanks, I'll use the timestamp method. I didn't see that before it was posted today.
Posted
New Member
Todd
Posts: 63
63
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.
Posted
Development Team Leader
Classicmotorcycling
Posts: 2085
2085
Glad it is working for you Todd.
Cheers,

David Greening
Posted
New Member
Todd
Posts: 63
63
Originally posted by Classicmotorcycling
Glad it is working for you Todd.

Thanks, me too. Makes my life easier.
You Must enter a message