PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > HTML form upload works, CURL fails when uploading file from c:
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
HTML form upload works, CURL fails when uploading file from c:

Réponse
 
LinkBack Outils de la discussion
Vieux 06/01/2008, 00h37   #1
John Gunther
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut HTML form upload works, CURL fails when uploading file from c:

PHP 5.2.1 on Apache/Linux. Client is Firefox and IE7 on Windows XP.

Uploading C:\boot.ini works great from an HTML type="file" form element
but fails using what should be the equivalent:
curl_setopt($ch,CURLOPT_POSTFIELDS,array('peru'=>' @C:/boot.ini'));

CURL error is "failed creating formpost data". Same CURL works when the
test file resides on the PHP server:
curl_setopt($ch,CURLOPT_POSTFIELDS,array('peru'=>' @/home/user/boot.ini'));

so problem seems to be in the '@C:/boot.ini' filespec. Substituting
'@C:\boot.ini' or '@C:\\boot.ini' doesn't .

What am I doing wrong?
  Réponse avec citation
Vieux 06/01/2008, 00h57   #2
John Gunther
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: HTML form upload works, CURL fails when uploading file from c:

Well, <dope slap> I think I understand the problem now: CURL is
operating from the server so it knows nothing about C: on the client!

So how do I solve my problem? I want to upload multiple files from C: to
the server based on a single wildcard spec typed into an HTML form by
the user.

John Gunther wrote:
> PHP 5.2.1 on Apache/Linux. Client is Firefox and IE7 on Windows XP.
>
> Uploading C:\boot.ini works great from an HTML type="file" form element
> but fails using what should be the equivalent:
> curl_setopt($ch,CURLOPT_POSTFIELDS,array('peru'=>' @C:/boot.ini'));
>
> CURL error is "failed creating formpost data". Same CURL works when the
> test file resides on the PHP server:
> curl_setopt($ch,CURLOPT_POSTFIELDS,array('peru'=>' @/home/user/boot.ini'));
>
> so problem seems to be in the '@C:/boot.ini' filespec. Substituting
> '@C:\boot.ini' or '@C:\\boot.ini' doesn't .
>
> What am I doing wrong?

  Réponse avec citation
Vieux 06/01/2008, 02h38   #3
Andrés Robinet
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut RE: [PHP] Re: HTML form upload works, CURL fails when uploading file from c:

> -----Original Message-----
> From: John Gunther [mailto:php@bucksvsbytes.com]
> Sent: Saturday, January 05, 2008 8:57 PM
> To: php-general@lists.php.net
> Subject: [php] Re: HTML form upload works, CURL fails when uploading
> file from c:
>
> Well, <dope slap> I think I understand the problem now: CURL is
> operating from the server so it knows nothing about C: on the client!
>
> So how do I solve my problem? I want to upload multiple files from C:
> to
> the server based on a single wildcard spec typed into an HTML form by
> the user.
>
> John Gunther wrote:
> > PHP 5.2.1 on Apache/Linux. Client is Firefox and IE7 on Windows XP.
> >
> > Uploading C:\boot.ini works great from an HTML type="file" form

> element
> > but fails using what should be the equivalent:
> > curl_setopt($ch,CURLOPT_POSTFIELDS,array('peru'=>' @C:/boot.ini'));
> >
> > CURL error is "failed creating formpost data". Same CURL works when

> the
> > test file resides on the PHP server:
> >

> curl_setopt($ch,CURLOPT_POSTFIELDS,array('peru'=>' @/home/user/boot.ini'
> ));
> >
> > so problem seems to be in the '@C:/boot.ini' filespec. Substituting
> > '@C:\boot.ini' or '@C:\\boot.ini' doesn't .
> >
> > What am I doing wrong?

>


You can't solve this issue with HTML+javascript+PHP alone. You will need
plugin support (a Java applet, an ActiveX control, Flash). Google for
"swfupload", though there are similar projects, it seems to be one of the
easiest solutions as it only requires you to know javascript (no guarantees
anyway).

Rob


Andrés Robinet | Lead Developer | BESTPLACE CORPORATION
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308
| TEL 954-607-4207 | FAX 954-337-2695
Email: info@bestplace.net | MSN Chat: best@bestplace.net | SKYPE:
bestplace | Web: http://www.bestplace.biz | Web: http://www.seo-diy.com
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h33.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11844 seconds with 11 queries