Upload, Rename and get information file

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
Fakiro82
User
Posts: 108

Upload, Rename and get information file

Post by Fakiro82 »

Hi,
I need to:

  1. Upload file (any file).
  2. Rename file (it's ok, I rename file with guid)
  3. Get information like filename, extension and path and insert into table (mysql table)
  4. Insert link to open file

How can I do to execute 3 and 4 dot?

Someone can help me?

Thank you so much,
Andrea.


arbei
User
Posts: 9354

Post by arbei »

  1. Get information like filename, extension and path and insert into table (mysql table)
    You can use the pathinfo() php function to get the information.
    hxxp://php.net/manual/en/function.pathinfo.php

  2. Insert link to open file
    Setup the view tag as image then try again.

Read help file topic: "Project Setup" -> "Field Setup" for your information.


Fakiro82
User
Posts: 108

Post by Fakiro82 »

Hi,

  1. Also if i set field as image, don't work.

I need to upload any type of file (zip,pdf,doc,xls,etc.....) and I need to have hyperlink to open file.

Thank you so much,
Andrea.


arbei
User
Posts: 9354

Post by arbei »

I need to upload any type of file (zip,pdf,doc,xls,etc.....) and I need to have hyperlink to open file.

Set up the "HREF field" valued with the upload filed in [View Tag] of the upload field.


Fakiro82
User
Posts: 108

Post by Fakiro82 »

Hi,
now it's work. Thank you!

How can I use pathinfo to insert data into table?

Sorry but i'm new user of phpmaker.

Thanks!


arbei
User
Posts: 9354

Post by arbei »

Search "PHP pathinfo" in Google search and look for more examples, then use ew_Execute to run your SQL to insert data to the database table.

Read help file topic: "Server Events and Client Scripts" -> "Some Global Functions" for the information of ew_Execute().


Fakiro82
User
Posts: 108

Post by Fakiro82 »

Thanks


Fakiro82
User
Posts: 108

Post by Fakiro82 »

Hi,
How can I upload info like (filename, path, extension) in table after upload file? Can I use row_inserting and row_upadate?
I tried to use pathinfo as you tell me but not work.

Can you write the correct code please?

Thank you so much,
Andrea.


arbei
User
Posts: 9354

Post by arbei »

Post your code here, so others can know what your problem in syntax is.


Fakiro82
User
Posts: 108

Post by Fakiro82 »

Hi arbei,

I did not write the code yet because I did not understand how and where to write it. I'm a new user of Phpmaker and I'm trying to figure out how it works.
I would also have another question:
I have a table (table1). Table 1 shows a select field. I need that when the value in the select is changed, I have to insert a new record in Table2 taking the values ​​from table1. For example:

Table1
id(document code) -->Value: 12345678912
select-->Value: Note (on change event)
date-->Value: 2017-05-01

Table2
id(progressive autoincrement)-->Value: 1 (autoincrement field)
Document Code-->Value: 1234567889012 (value from table1)
Select-->Value: Note (value from table1)
datetime-->Value: 2017-05-01 (value from table1)

When I change value in select (table1) I need to insert in table2 the value from table1
How can i do this?

Thank you so much arbei for your help.

Andrew.


arbei
User
Posts: 9354

Post by arbei »

I need that when the value in the select is changed, I have to insert a new record in Table2 taking the values from table1.

Do you mean the value is changed after the record is submitted? if so, use Row_Updated Server Event and compare the value in $rsold and $rsnew, then insert a record in another table by using ew_Execute().

Read help file topic: "Server Events and Client Scripts" -> "Row_Updated" and "Some Global Functions" for more information.

if you mean the insert a record to another table once the user selects the value in the select box, it will insert a lot of records if the user keeps selecting the value.

If you really want to do it, you can add your code in [Edit Tag] -> [Client side event], and use the ew_Ajax function to submit the SQL for execute, in order to insert a record to another table.

Read help file topic: "Project Setup" -> "Lookup Table" for your information.


Post Reply