/    Sign up×
Community /Pin to ProfileBookmark

if isset show echos without sending anything in the form

[B]isset[/B] check that exist a variable, but do not Necessarily a value useful or it that I wait.

I have a form with two [B]input[/B] to upload [B]multiple[/B] files, with ‘size’ the [B]submit[/B] button, more the function [B]isset[/B] and ‘name’ with some echos …
When I press the [B]send[/B] button; without being charged anything, It show the echos, or results

[URL=”http://walter123pruebas.comze.com/Dividir.php”][B][COLOR=”#0000CD”]PAGE HERE[/COLOR][/B][/URL]

[URL=”http://pasted.co/e71c862c”][B][COLOR=”#0000CD”]CODE HERE[/COLOR][/B][/URL]

[B]isset ()[/B] is something “useless” in the case of [B]$ _FILES[/B] because this array exist, but that does not mean you’ve uploaded something.

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJan 27.2016 — To lazy to look at your code ( ? ), but you're probably better off with either [FONT=Courier New][B][COLOR="#A52A2A"]!empty($_FILES)[/COLOR][/B][/FONT] or [FONT=Courier New][B][COLOR="#A52A2A"]count($_FILES)[/COLOR][/B][/FONT] .
Copy linkTweet thisAlerts:
@ApolexNetauthorJan 27.2016 — [B][/B]? It is working out just by pressing [B]send[/B], It show the results. :/

[B]Look it:[/B]

[B][COLOR="#0000CD"]PAGE HERE[/COLOR][/B]

[B][COLOR="#0000CD"]CODE HERE[/COLOR][/B]

I tried this and either:

[code=php]
if(isset($_POST["submit"])) {

//valida que el formulario se envio

// cualquiera de las 2 formas

if($_FILES['accs']['name'] == "") {

echo "no envió nada.";
}

if($_FILES['accs']['size'] == 0) {
echo "no envió nada.";
}

// puedes guardar una variable para manejar errores

if ($errores == "")
{
Ejecuto

}
}
else
{
echo "no envió el formulario";
}
[/code]


What could I do? ?
Copy linkTweet thisAlerts:
@ApolexNetauthorJan 28.2016 — I tried with a while, and It get me a result similar to that I want. But with errors. ?

while($res = $_FILES['archivos1']['name'][0] <= $_FILES['archivos1']($insert))

$dn = ("cAAn$id");

$dn1 = chunk_split($dn, 1, '.');

{

echo $dn1;

}

There is any something similar for I get it to run, Not without uploading something previously before of send.
Copy linkTweet thisAlerts:
@ApolexNetauthorJan 28.2016 — I have it, I have placing an in_array, only that have a problem when I upload multibles files, and I change in the form

name="[B]archivos[/B]" and name=[B]"archivos1[/B]" for name="[B]archivos[][/B]" name="[B]archivos1[][/B]":

[B][FONT=Arial Black][SIZE=2]



It gives me error...[/SIZE]
[/FONT][/B]



[code=html]
<form name="formu" id="formu" action="Dividir.php" method="post" enctype="multipart/form-data">
<dt><label>Accesorios opcional</label></dt>
<input type="file" multiple id="arc" name="archivos[]" /><br />
<label>Prendas opcional</label></dt>
<input type="file" multiple id="arc" name="archivos1[]" /><br />
<input type="text" Value="99999716" name="numero" /><br />

<input type="submit" value="Enviar" id="envia" name="envia" />

</form>[/code]


[code=php]
$formatos = array('.jpg', '.png');

$nombre = $_FILES['archivos1']['name'];
$ext = substr($nombre, strrpos($nombre, '.'));
if (in_array($ext, $formatos)) {
echo $dn1;
} else{echo no;}
}
[/code]

[B]¿As I solve the problem of [SIZE=4][B][][/B][/SIZE]?[/B]
Copy linkTweet thisAlerts:
@NogDogJan 28.2016 — [code=php]$_FILES['archivos']['name'][0]
$_FILES['archivos']['name'][1]
$_FILES['archivos']['name'][2]
// etc....
[/code]
Copy linkTweet thisAlerts:
@ApolexNetauthorJan 28.2016 — You made me realize the error, and I created a [B]for[/B] to change of the numero. Thanks as always, you deserves much money.

[code=php]
$_FILES['archivos1']['name'][$i]
$_FILES['archivos']['name'][$i]
[/code]

?
×

Success!

Help @ApolexNet spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...