Href - File Name taken from mysql database - mysql

I currently have a form that uploads the data via PHP to a PDF form and that form is generated and saved on my ftp server. The data is also posted to a mysql database and the name of the file name for the pdf is the unique id of the mysql record (eg. 85124.pdf)
I would like to set up a link where the user can print the generated PDF file as a receipt but cannot figure out how to have the link call up the specific file for that specific record.
For example:
pdf - where the filename would be the same as the unique mysql id (eg. 85124). Is this possible?
I see that I may not have stated properly what I am trying to do and in what enviornment.
I have a page set up where users/clients can book their shipments online ( I work for a small shipping company). The user puts in their shipping adress and such and once they hit the submit button the following happens:
The data is sent to a mysql database on my host (godaddy) and the table is populated with that specific record. The unique id becomes the tracking number for the shipment.
$tracking=mysql_insert_id;
The data is also sent as a FDF file to my ftp and stored in a folder. The name of the FTP is determined by what the the tracking number is after it is put into the mysql database.
$fdf_file=$tracking().'.fdf';
$fdf_dir=dirname(__FILE__).'/results';
The data is then placed into a PDF form that is on my ftp.
$pdf_doc='https://www.mysite.com/shipformrso.pdf';
On the screen after the form is submitted the client receives a confirmation that their from was completed properly and they are given their tracking number.
echo "<font color='red' size='+1'><b>" . 'Your tracking number is '.$tracking() . '. <n\> PLEASE PROCEED TO THE SERVICE DESK TO RECOVER YOUR LABELS.' ."</b></font>";
What I would like to do is have another link where the user can click on and have the browser open up the FDF/PDF file was generated for their specific shipment. This is where I have the problem. I can't seem to figure out how to create the link specific file that was just generated.
Thanks for any help.

As much as I understand, you don't want to show the pdf printing link to your users? At least, the id of the pdf file, which is plainly holded in the db? Then, you can hash your id, POST it to the server and decrypt it on server side then proceed to pdf showing/printing page. In this way no user can understand the hash data, and how to decrypt it. Only your server side script does.;)
For ex:
When user enters here:
blabla.com/?id=SOME_HASHED_VALUE
On the server side:
You decrypt it, and make the SOME_HASHED_VALUE to look like this: 45869 - which is the unique id holded in the db. And then proceed normal flow. ;)

Related

Download files from object storage in visual app of Oracle Visual Builder. How to use data from ATP Database to get dinamically the name of the files

I am trying to download specific files from the Object Storage in the Oracle Cloud in my Oracle Visual Builder App (my visual builder is inside OIC, Oracle Integration Cloud).
I'd like to use the name of the "File URL" column (see the picture above) as the file name of the file to download from the Object storage, but this file name should be different from every download button (again in the picture above, you can see that every download button should download the file that has the name of the value of the "File URL" column). The File URL column is the field of a business object which is linked to the SDP variable and the data arrives from an ATP database that is inside the Oracle Cloud Infrastructure. The column "First File" contains the Download buttons. In the properties of this button there is an ojAction event which is linked to an action chain (see picture below).
I followed this guide (Download from OCI Storage section) to download one file, but I mapped the "filename" input parameter with a fixed value (the name of an existing files inside the object storage). Now, I'd like to make the filename value dynamic, but I don't know how to create a variable that gathers all the values of the specific column (File URL) in the DB and how to pass the single value of this column to the filename parameter. I have tried to create an SDP type variable that gets only the File URL values, but it's not getting the values of the file names. Do you have suggestions or have you seen a guide that is maybe useful to solve this issue?
If I understood the problem correctly, you can't retrive the specific file URL linked to the row button the user click in order to download the right file.
If that's the case, then instead of using a button, you could use the "first-selected-row" event linked to the table itself; that will pass all the values of the selected row as parameter, and will allow you to link "$variables.rowData.fileURL" or whatever the field is called to the REST call.

Multiple entries containing exact file paths or text file on server containing multiple file paths with a single entry in the database to that file?

Here's some background information to help understand my dilemma. I've got a system written in PHP where users can fill out a form, upload a few images and everything gets archived in a .zip, I then have an "Account Page" that echo's a simple table containing a list of all of that specific users uploaded .zip's, the reason I'd need separate filepaths for each and every .zip is because no matter the user, they all need to be in the same single folder on the server for the broader application to work (these .zips are used for a mobile based Package Manager; see Cydia).
Would the smarter choice be to have every name of each .zip stored in a table on the database with things like the username and user_id tying to each entry, which would result in a few entries being for one user, and a few more being for a different user (depending on upload time), and everything will be unorganized. If I need to enter the database and manually search for a specific user's uploaded .zip's, I'll have to sort them out by user_id.
OR
Would it be more cost effective (in terms of passing data and hardware limitations) to have an XML file or even a plain .txt file on the server with a list of the users uploaded .zip's, and an exact file path pointing to them, and in the database simply have one column tied to the rest of the users information that points to that file containing multiple lines of filepaths?
It's a mouth full I know, and I have no problem achieving either of them as it's well within my skillset and knowledge of PHP & MySQL, I'm just not too sure which is the most secure and the best practice in the industry for this type of system.

is it possible to save data from a html form to an excel file with web services?

I have made a newsletter with html and CSS, and in that newsletter I have 4 text boxes which takes the users name,family name,phone number,email address.Can I use a web service to transfer this data from the HTML form to an excel file, or a database on a host?
Is it possible at all? saving data from a html form to an excel file with web services?
If yes, how?
First of all, I assume you save this data into a database. That would be my approach at least.
So:
Send the data using a form to your server application (ASP.NET or something alike);
Save it in the database (or process it right away);
Then use a package like EPPlus to generate the Excel file in a web service. See their project page about the how to do that;
Return the result to the client.
yes thats possible but you would need a fifth button like send information that would post those fields to a php script on your server and then save it into your database
look here to see how to post information to your server
http://www.w3schools.com/php/php_forms.asp
and here for a small mysql tutorial
http://www.w3schools.com/php/php_mysql_intro.asp

Copy folder contents into Access database

I was wondering if anyone might know how to import the contents of a folder into a Access table.
I have a database that's used to make ID cards for students with a unique ID. When students get their photos taken to be printed on these cards, the files are saved as jpegs with the student ID numbers as the filename. (E.g., student 1234567's photo would be saved as 1234567.jpg.) These photos are all saved in the same folder.
I would like to be able to have Access (or a script) automatically generate a table for this folder with two columns: the filename and the image (as a BLOB). That way, I would be able to add a student's photo to his or her data record with a simple SQL query.
My VBA skills are not great (I'm in the process of learning), so any help would be appreciated. Thanks!
There is an MS article: http://support.microsoft.com/kb/103257, however, with the recent version of Access (2010), you would be better to consider the attachment data type which will also allow you to display the photo on a form.

How to get a notification when user deletes a file?

Is there a way to get a notification (like a state with "delete" action and file id) when the user deletes a file of my app on drive?
Thanks,
Daniel
There is no notification right now, but if you look at the Changes for an account, there will be an entry with deleted field set to true with the File ID for the deleted file.
I don't have a knowleges in Google-drive-sdk, but I have already create a similar function in php:
With a CRON ( php script running in background task) I list files in my folder, and I compare with a database ( I add a filename, size file, in database when user add file) , if file exist in database, and not exist in my list, user delete this file and I want send a notification...
until a person expert on "Google-drive" you find a solution, I hope mine will come in handy.