Upload mod ; check if file exists - Posted (4829 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
Average Member
Zuel
Posts: 540
540
Avatar Mod has a class with that information. Has a checkbox for overwrite and informs user if file already exists. You probably save some cash and see what he did.<
My Completed Mods: News Mod | Zuel's Avatar Add-on
In Development: World of Warcraft Member Roster | [C# Based Forum]
Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.
MSN / E-Mail: ucyimDa_Ruler@Hotmail.com

Personal Bookmarks: How to work a DBS File
Posted
Retired Support Moderator
MarcelG
Posts: 2625
2625
Zuel, thanks for the tip, but which avatar mod would that be ? I've got an old version (by Huw if I'm not mistaking) running on oxle.com<
Posted
Snitz Forums Admin
ruirib
Posts: 26364
26364
I'd guess Zuel's own avatar mod smile. Check the mod W/Code forum, it's sitting at the top...<
Posted
Average Member
Zuel
Posts: 540
540
No no no,

RichardKinser's Mod. Sorry for not being specific. I didn't write the Upload Class, he did. You can find it on SnitzBitz, Hamlin converted it for 3.4. The base code on there would do you some good.<
My Completed Mods: News Mod | Zuel's Avatar Add-on
In Development: World of Warcraft Member Roster | [C# Based Forum]
Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.
MSN / E-Mail: ucyimDa_Ruler@Hotmail.com

Personal Bookmarks: How to work a DBS File
Posted
Retired Support Moderator
MarcelG
Posts: 2625
2625
Oh, that one. Thanks! I'll investigate tonight ; saves me 75 bucks.<
Posted
Forum Admin
HuwR
Posts: 20611
20611
Did you find the info you needed MarcelG ?<
Posted
Retired Support Moderator
MarcelG
Posts: 2625
2625
Not yet...haven't found the time to do that yet. Will do so tonight.<
Posted
Retired Support Moderator
MarcelG
Posts: 2625
2625
Guys...I'm lost....okay, not actually lost as in not knowing where I am or unable to find my way back, but I'm lost as in I cannot figure out how to get this working. The referal to the avatar upload mod brought me some other insights, but not the one I was looking for. I've described it in more detail here: http://oxle.com/topic.asp?tid=3826 and I've decided to put an incentive with it for the person who can help me out bigsmile
The theory is this:
If you upload a file to the site, you get a form with a browse button and a submit button. If you - for instance - select the file C:\MY DOCUMENTS\TESTFILE.TXT, this and you press the submit button, the file gets uploaded to http://oxle.com/uploaded/<member id>/testfile.txt. The <member id> is unique for every member.
So, in my case, uploading the file mypic.jpg to oxle would result in the following file: http://oxle.com/uploaded/18/mypic.jpg

Now, I want to improve this feature with the following extra feature. If you want to upload mypic.jpg, and that file already exists, I'd like to see a warning, ánd I want to have the option to overwrite the file (default), or rename the file (non default option).
I want that warning ánd that choice before I hit the submit button, so without a page refresh. If you think you have the solution for this, please read on.<
Posted
Forum Admin
HuwR
Posts: 20611
20611
it is not possible in the way that you want it to be for one simple reason, it is not possible to get the filename of the uploaded file until the form is posted, and for obvious security reasons this stuff should be done serverside.<
Posted
Average Member
Zuel
Posts: 540
540
Code:

<script language="JavaScript"><!-
function CheckForImage(URL) {
var ThisImage = new Image();
ThisImage .onError = alert('The following does not exist. Please correct to continue.<br><br>" + URL');
ThisImage .src = URL;
}
//--></script>

<form name="upload">
<input type="file" onChange="CheckForImage(document.upload.file.value);" name="file" />
<input type="submit" value="submit"
</form>

Spaghetti code but it should do what you want. My javascript has gotten horrible within the past few months. I believe you got the uploading piece already.
You should be able to use javascript to grab just the file name then tag on your forumurl to the beginning. You should be able to create this javascript function dynamically to get all that, even the member id to concatinate the forum url + member id folder + image name.<
My Completed Mods: News Mod | Zuel's Avatar Add-on
In Development: World of Warcraft Member Roster | [C# Based Forum]
Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.
MSN / E-Mail: ucyimDa_Ruler@Hotmail.com

Personal Bookmarks: How to work a DBS File
You Must enter a message