Jump to content

Creating/getting a url to a dynamically created file...


Recommended Posts

Hi

 

My app sends out emails.

 

Included in the email is a link to a PDF document which can be downloaded and views.

 

The document(s) reside in different folders on the server, only known at creation time.

 

My app can run from the root as well as a folder

 

How can I get the url to the file for inclusion in the email.

 

examples are

 

http://www.myserver.com/docs/document1.pdf

http://www.myserver.com/document2.pdf

http://www.myserver.com/docs/anotherfolder/document1.pdf

 

Thanks

 

Well, perhaps you could stop putting these files all over your server and pick just one place for them.

 

Path is known at creation time? Good. Path is only known at creation time? Well then the file just got lost because there is literally nothing else that knows the path to the file. So you should probably record that path somewhere during creation so you can retrieve it again later.

Umm... So, like, you'll have a file in /thismonth, and then move it into /lastmonth, and then move it into /soontobedeleted?

Don't do that. If you want files in a directory according to the month, use a directory name for the month. Like "november-2015" or something. And then don't delete it later. If you really do have to delete it, delete the directories from 2+ months ago.

 

Now, you say that you know where the files went and that you store that location to retrieve it later. What's stopping you from retrieving it now?

Now, you say that you know where the files went and that you store that location to retrieve it later. What's stopping you from retrieving it now? 

 

...because the url is different for each server

 

Sometimes the app is in the root, sometimes in a sub folder

PHP only executes on one server at a time, so it doesn't matter if there's more than one server running this code.

 

So basically, I'm saying these things like "put the file in one specific location" and "if you stored the location somewhere then look up that location again later" and you're saying those don't work. That's a problem because you don't really have any options besides that. Something has to give.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.