Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fake name for a file

Status
Not open for further replies.

RLyra

Programmer
Dec 6, 2002
21
BR
I need to upload many files, and some could have the same name. I will save the originals names in a database and save the files with sequential numbers at names. This is ok.

example: "Report July.Doc" became just "1234".

Ok, but I need to find a way to make a link that point to "1234" but show "Report July.Doc". I need a link to see and download the doc, with the right name: Report July.doc.

Suggestions ??
 
Depending on the language being used to upload the file you could implement a "look first" technique.

Try opening the file on the recipent system in a non-destructive mode. If it opens OK then it must be there so close it, add a sequence number to the filename and retry the opening. If the open then fails you know you have a unique name. Then proceed to open it as normal output with that name. If you add the sequence numbers to the end of the filname then you should need no cross reference as the report name(s) will be part of the actual filename.

Hope this helps somewhat.

Bob
 
I am using PHP and the upload is Ok. My problem is after that.

I'm sure that I will have many docs with the same name. I will accept versions of the same file, so I will have the same name many times.

My problem is how to hide this from the final user. I don’t want to show a link to a file called 1234. It is not good for the browser and not elegant.
 
You have the information in a database, right? Display that.

Get the fake name and the real name from the database, and use "<a href=/realname>fakename</a>".
 
This is realy not the point.

1 - when the user try to download ("save source") he file will be saved with a wrong name.
2 - when the user try to open the file (as he could do with a PDF, or a DOC, JPG< etc) whe name don't have this extension so, it's not work.

This is not a HTML problem, it must be solved with HTTP.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top