How save a file from SC server to local PC directory

Dear all,

I’m trying to save a file (i.e. a name_file.csv) to local PC directory.
When I was on testing on my PC it works but now from the server not.

SC try to download it into …
Can’t create/write to file ‘/var/lib/mysql/C:/Temp/mercury_movmag_download.csv’ (Errcode: 2)
that obviuosly it’s not correct.
Is there a way to ask to user in which directory download it ?
An easy sample ?
Many thanks
Giovannino

Re: How save a file from SC server to local PC directory

show us your code when you’re opening this file “mercury_movmag_download.csv”. how are you doing this?

Re: How save a file from SC server to local PC directory

This is the PHP connected to the Export Button I did.
… Remember that I’m not a programmer and so please answer me in a … easy way. Thanks. Giovannino

$filename_artico = ‘C:/Temp/mercury_articoli_download.csv’;

if (file_exists($filename_artico))
{
echo “Il file $filename_artico esiste gi?. Verr? cancellato”;
unlink(‘C:/Temp/mercury_articoli_download.csv’);

sc_exec_sql(’
SELECT tipoma_xid_id, codice, name, desbre, descri, res_partner_xid_id, date_creation,
date_modification, user_creation_id, user_modification_id, classe_cesp, nr_matricola,
nr_serie INTO OUTFILE ‘C:/Temp/mercury_articoli_download.csv’
FIELDS TERMINATED BY ‘;’
FROM warehouse_artico
');

} else
{
sc_exec_sql(’
SELECT tipoma_xid_id, codice, name, desbre, descri, res_partner_xid_id, date_creation,
date_modification, user_creation_id, user_modification_id, classe_cesp, nr_matricola,
nr_serie INTO OUTFILE ‘C:/Temp/mercury_articoli_download.csv’
FIELDS TERMINATED BY ‘;’
FROM warehouse_artico
');
}

Re: How save a file from SC server to local PC directory

This is the error:

Errore durante l?accesso alla banca dati:
Can’t create/write to file ‘/var/lib/mysql/C:/Temp/mercury_movmag_download.csv’ (Errcode: 2)SELECT causal_xid_id, invent, flagpm, artico_xid_id, tipoma_xid_id, dipart_xid_id, sedeco_xid_id, dipart1_xid_id, codcdc_xid_id, rdirif_id, datmov, avviso, avvdat, nprotrich, datrich, richie, rispos, delibe, doncom_xid_id, tipcon_xid_id, nota00, nota01, ricmer, ordnum, orddat, res_partner_xid_id, datab1, edpmot_xid_id, invold, numpro, datpro, flaurg, rifper, quanti, flaeva, nrprot01, nrprot02, nrprot03, testo01, testo02, testo03, data01, data02, data03, date_creation, date_modification, user_creation_id, user_modification_id INTO OUTFILE ‘C:/Temp/mercury_movmag_download.csv’ FIELDS TERMINATED BY ‘;’ LINES TERMINATED BY ’ ’ FROM warehouse_movmag

Re: How save a file from SC server to local PC directory

When you use INTO OUTFILE … you are executing this command on the server side.

Imagine:

                 SERVER WITH MYSQL 
   
                /               \      

Customer acessing the system 1 Customer acessing the system 2 …

This command will try to save a file on the server side. Not on the client.
You need to save a file on the server side and create an html with a link to the file so your customers can download it. Or send through email…

Re: How save a file from SC server to local PC directory

Thanks,

it will be hard but I will try…
Bye
Giovannino

Re: How save a file from SC server to local PC directory

I did it and the result is on attached image.
Is there a way to show to end user the server directory in a cleaner way (3) (less technical…)

http://img832.imageshack.us/i/urllink.jpg/

Thanks
Giovannino

Re: How save a file from SC server to local PC directory

Watch this site

http://www.w3schools.com/PHP/php_file_upload.asp

Re: How save a file from SC server to local PC directory

Create the file on a path inside www and create a html to the final user to download what you want.
Ex:

INTO OUTFILE ‘/var/www/tmp/mercury_articoli_download.csv’

and
echo "
<html>
<body>
<a href=’/tmp/mercury_articoli_download.csv’Click here to download the file exported.</a>
</body>
</html>
";

just an example.