Jump to content

Get file path by hash tag


maddmac
 Share

Recommended Posts

$pagefile->hash() is a method - it calculates/returns a value when you call the method. It doesn't represent some data that is stored in the database, so it's probably not a good candidate for finding a file.

The unique property of a file in a Files field is the name. In other words, a given file name can only occur once in a given Files field on a given page. You can use phpMyAdmin or Tracy Adminer to take a look at the data that is stored in the database for a Files field.

If you explain more about your scenario and what you're wanting to do then people might be able to suggest a workable approach.

  • Like 1
Link to comment
Share on other sites

Thanks for the info @Robin S I have  a page where a user can select from a series of files which are then sent with a form post, these files are then zipped on the fly for the user to download. I would need to send a list of files to a form processor page that would collect the files to be zipped dynamically. Of course to do that I need a unique identifier to be passed. 

Link to comment
Share on other sites

10 hours ago, maddmac said:

I would need to send a list of files to a form processor page that would collect the files to be zipped dynamically. Of course to do that I need a unique identifier to be passed.

What will suffice for the unique identifier depends on if the selectable files are all stored in the same field on the same page. If they are then the values in your select multiple that the user chooses the files with can just be the filenames of the files,  e.g.

<option value="filename_foo.pdf">Foo</option>

But if the files come from multiple Files fields on the same page then you'd also need to include the field name, e.g.

<option value="my_files_field|filename_foo.pdf">Foo</option>

And if they come from multiple pages then you'd also need to include the page ID, e.g.

<option value="1234|my_files_field|filename_foo.pdf">Foo</option>

With the second two options your processor page template would explode the received values on the pipe character so you can validate and get the relevant file from the relevant field on the relevant page.

10 hours ago, maddmac said:

I would need to send a list of files to a form processor page that would collect the files to be zipped dynamically. Of course to do that I need a unique identifier to be passed.

What will suffice for the unique identifier depends on if the selectable files are all stored in the same field on the same page. If they are then the values in your select multiple that the user chooses the files with can just be the filenames of the files,  e.g.

<option value="filename_foo.pdf">Foo</option>

But if the files come from multiple Files fields on the same page then you'd also need to include the field name, e.g.

<option value="my_files_field|filename_foo.pdf">Foo</option>

And if they come from multiple pages then you'd also need to include the page ID, e.g. <%

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...