Reply to Re: Uploading using POST method

Your name:

Reply:


Posted by Bob Bedford on 11/19/07 16:06

"ZeldorBlat" <zeldorblat@gmail.com> a ιcrit dans le message de news:
f8e2a53c-00bf-4a21-951c-7395594478e7@a28g2000hsc.googlegroups.com...
> On Nov 19, 10:10 am, "Bob Bedford" <b...@bedford.com> wrote:
>> Hi all,
>>
>> I've to accept a file that is sent using a POST method.
>>
>> The file will be sent using this URL:
>>
>> http://username:p...@www.mysite.com/upload.php
>>
>> How can I retrieve the username and passord and rename the file ? Should
>> I
>> use substring using the URI ? Pseudocode below is the best way to do so ?
>>
>> <?php
>> $user = substr($_SERVER['REQUEST_URI'],pos('//'),pos(':'));
>> $pass = substr($_SERVER['REQUEST_URI'],pos(':'),pos('@'));
>> $userid = select userid where user = $user and pass=$pass.
>> renamefile($_FILES['userfile']['tmp_name'],$userid)
>> ?>
>>
>> Thanks for help.Bob
>
> The username will be in $_SERVER['PHP_AUTH_USER'] and the password
> will be in $_SERVER['PHP_AUTH_PW'].
>
In fact not soo easy...how to get the filename ?

In the case of a form, you get the control name for getting the file like
this:
$_FILES['formname']['tmp_name']

But since there is no form, what the name I've to put in place of 'formname'
?

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация