I want to extract the name of the photo uploaded.
print_r of $_FILES yields:
Files: Array ( [picture] =Array ( [name] =>
DSC_1802-saoirse-riona.jpg [type] =image/jpeg [tmp_name] =>
/tmp/phpJTspHZ [error] =0 [size] =76096 ) )
so we have an array with one element, picture, that contains an
array with an index, name, with a value of DSC_1802-saoirse-riona.jpg
I get the correct value when I:
$pic_name = $_FILES['picture']['name'];
echo $pic_name
however when I use:
echo "<br />pic_name = $_FILES[picture][name]";
I get:
pic_name = Array[name]
Why does the echo with the array reference not work while the
assignment does ?
bill 9 1428
On Nov 18, 10:13 am, bill <nob...@spamcop .netwrote:
I want to extract the name of the photo uploaded.
print_r of $_FILES yields:
Files: Array ( [picture] =Array ( [name] =>
DSC_1802-saoirse-riona.jpg [type] =image/jpeg [tmp_name] =>
/tmp/phpJTspHZ [error] =0 [size] =76096 ) )
so we have an array with one element, picture, that contains an
array with an index, name, with a value of DSC_1802-saoirse-riona.jpg
I get the correct value when I:
$pic_name = $_FILES['picture']['name'];
echo $pic_name
however when I use:
echo "<br />pic_name = $_FILES[picture][name]";
I get:
pic_name = Array[name]
Why does the echo with the array reference not work while the
assignment does ?
bill
Put quotes around your array keys:
$_FILES['picture']['name']
ZeldorBlat wrote:
On Nov 18, 10:13 am, bill <nob...@spamcop .netwrote:
>I want to extract the name of the photo uploaded.
print_r of $_FILES yields: Files: Array ( [picture] =Array ( [name] => DSC_1802-saoirse-riona.jpg [type] =image/jpeg [tmp_name] => /tmp/phpJTspHZ [error] =0 [size] =76096 ) )
so we have an array with one element, picture, that contains an array with an index, name, with a value of DSC_1802-saoirse-riona.jpg
I get the correct value when I: $pic_name = $_FILES['picture']['name']; echo $pic_name
however when I use:
echo "<br />pic_name = $_FILES[picture][name]";
I get: pic_name = Array[name]
Why does the echo with the array reference not work while the assignment does ?
bill
Put quotes around your array keys:
$_FILES['picture']['name']
That, unfortunately, generates the dreaded:
Parse error: syntax error, unexpected T_ENCAPSED_AND_ WHITESPACE,
expecting T_STRING or T_VARIABLE or T_NUM_STRING in...
bill
On Sun, 18 Nov 2007 16:47:17 +0100, bill <no****@spamcop .netwrote:
ZeldorBlat wrote:
>On Nov 18, 10:13 am, bill <nob...@spamcop .netwrote:
>>I want to extract the name of the photo uploaded.
print_r of $_FILES yields: Files: Array ( [picture] =Array ( [name] => DSC_1802-saoirse-riona.jpg [type] =image/jpeg [tmp_name] => /tmp/phpJTspHZ [error] =0 [size] =76096 ) )
so we have an array with one element, picture, that contains an array with an index, name, with a value of DSC_1802-saoirse-riona.jpg
I get the correct value when I: $pic_name = $_FILES['picture']['name']; echo $pic_name
however when I use:
echo "<br />pic_name = $_FILES[picture][name]";
I get: pic_name = Array[name]
Why does the echo with the array reference not work while the assignment does ?
bill
Put quotes around your array keys: $_FILES['picture']['name']
That, unfortunately, generates the dreaded:
Parse error: syntax error, unexpected T_ENCAPSED_AND_ WHITESPACE,
expecting T_STRING or T_VARIABLE or T_NUM_STRING in...
Look at complex (curly) syntax:
<http://nl2.php.net/manual/en/language.types. string.php#lang uage.types.stri ng.parsing>
echo "<br />pic_name = {$_FILES['picture']['name']}";
--
Rik Wasmus
bill wrote:
echo "<br />pic_name = $_FILES[picture][name]";
echo "<br />pic_name = {$_FILES[picture][name]}";
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 12 days, 2 min.]
[Now Playing: ./orson/bright_idea/03_-_happiness.ogg.]
USD/EUR Exchange Rate Graph http://tobyinkster.co.uk/blog/2007/11/18/usd-eur/
On Sun, 18 Nov 2007 18:05:32 +0100, Toby A Inkster
<us**********@t obyinkster.co.u kwrote:
bill wrote:
>echo "<br />pic_name = $_FILES[picture][name]";
echo "<br />pic_name = {$_FILES[picture][name]}";
define('picture ','oops');
define('name',' wrong');
--
Rik Wasmus
Rik Wasmus wrote:
define('picture ','oops');
define('name',' wrong');
I know, I know, but I wanted to keep the code as similar as possible to
the OP's.
Besides which, it's not normal to define lower-case constants.
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 12 days, 15:31.]
USD/EUR Exchange Rate Graph http://tobyinkster.co.uk/blog/2007/11/18/usd-eur/
Toby A Inkster wrote:
Besides which, it's not normal to define lower-case constants.
And people who do so are not normal. They have something wrong with them
in their head. Just thinking about the idea makes me feel icky.
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 12 days, 17:44.]
USD/EUR Exchange Rate Graph http://tobyinkster.co.uk/blog/2007/11/18/usd-eur/
Toby A Inkster wrote:
bill wrote:
>echo "<br />pic_name = $_FILES[picture][name]";
echo "<br />pic_name = {$_FILES[picture][name]}";
Rik and Toby
Thanks, something new to learn.
bill
On Mon, 19 Nov 2007 09:34:23 +0100, Toby A Inkster
<us**********@t obyinkster.co.u kwrote:
Rik Wasmus wrote:
>define('pictur e','oops'); define('name', 'wrong');
I know, I know, but I wanted to keep the code as similar as possible to
the OP's.
Then again, why correct just one mistake and not the other?
Besides which, it's not normal to define lower-case constants.
Very true indeed.
--
Rik Wasmus This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Demian |
last post by:
Hi,
I developed an OCX in VC++, wich takes a VARIANT as parameter and
return a Long as the result of the operation. This VARIANT cames from
a client VB6.0 wich send an array of Byte as a VARIANT, so acomplish
Autonmation std.
I need to access the array inside the variant to load an user-defined
struct with it. To do this I used the myvariant->parray.pvData but it
didn't work. It seems that the data wasn't there...
I tried with...
|
by: Chris Styles |
last post by:
Dear All,
I've been using some code to verify form data quite happily, but i've
recently changed the way my form is structured, and I can't get it to work
now.
Originally :
The form is called "form1", and I have selects called "PORTA", "PORTB" ...
etc...
|
by: pt |
last post by:
Hi,
i am wonderng what is faster according to accessing speed to read
these data structure from the disk in c/c++ including alignment
handling if we access it on little endian system 32 bits system + OS
e.g. Windows, Linux, WinCE. I am not quite sure about the alignment of
the memory....
soln. 1: should be faster, I am not sure.
idx size (bytes)
1 4
|
by: pt |
last post by:
Hi,
i am wonderng what is faster according to accessing speed to read
these data structure from the disk in c/c++ including alignment
handling if we access it on little endian system 32 bits system + OS
e.g. Windows, Linux, WinCE. I am not quite sure about the alignment of
the memory....
soln. 1: should be faster, I am not sure.
idx size (bytes)
1 4
|
by: Chris |
last post by:
Hi,
I'd like to be able to access an attribute of a particular Python
object as fast as possible from some C code.
I wondered if using __slots__ to store the attribute would allow me to
do this in a faster way.
The reason I'd like to do this is because I need to access the
attribute inside a loop within some C code, and I find that the
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |