
Lerub
Membro Pleno-
Posts
164 -
Cadastrado em
-
Última visita
Tipo de conteúdo
Artigos
Selos
Livros
Cursos
Análises
Fórum
Tudo que Lerub postou
-
Yamaha UX16 e Key black 323 - Sem som (Ubuntu 17.10)
Lerub respondeu ao tópico de Lerub em Equipamentos de som e home theaters
Ok. Pode fechar esse. -
Yamaha UX16 e Key black 323 - Sem som (Ubuntu 17.10)
Lerub respondeu ao tópico de Lerub em Equipamentos de som e home theaters
Edit: Eu já resolvi o problema. Foi apenas um "erro de lógica". Eu pensei que, como o conector do piano eletrônico fosse transmitir o audio pra o Pc, eu teria que ligar o MIDIOUT. Eu liguei o outro plug e deu cérto. Eu executei esses passos: Eu não gravei um video com o instrumento,mas, é esse aqui: O dispositivo é esse: https://www.amazon.com/Yamaha-UX16-Midi-Interface/dp/B0002E2S1I/ref=sr_1_1?ie=UTF8&qid=1510778582&sr=8-1&keywords=yamaha+ux-16 -
Yamaha UX16 e Key black 323 - Sem som (Ubuntu 17.10)
Lerub respondeu ao tópico de Lerub em Equipamentos de som e home theaters
Sim. Tudo ok. Quando eu plugo o MIDi o visor digital não mostra nada. É normal? -
Eu recebi hoje o produto. ele é reconhecido pelo ALSA e pelo Jack. Porém, eu ligo o cabo Out na saída Out e nenhuma aplicação responde. As vezes, mesmo sem estar ligado na tomada, ao plugar o cabo MIDI, os leds acendem. Como eu resolvo isso? Eu já tentei 'apt-get install midi* (ou *midi, não lembro) e instalei 800M de pacóte. Alguns Yamaha support.
-
PHP Formulario para upload com nome e verificação de e-mail
Lerub respondeu ao tópico de Lerub em Web e banco de dados
Eu estou aprendendo a lidar com o PHPMail. Por enquanto, eu so aprendi a enviar para o e-mail que a pessoa digita no formulário. Eu vou ver como faço para incluir um log que registra todos os dados no formulário para ficar mais fácil de fazer a referencia para quem me enviou a imagem. E incluir um formulário para upload - tanto para o e-mail quanto um diretório do servidor - também. Edit: Eu temtei inserir esse código, para gerar o log com put $file = '/uploads/people.txt'; $current = file_get_contents($file); $current .= "$name"; file_put_contents($file, $current); e aparece esse erro E tentei de divérsas maneiras e deu o mesmo erro. <?php include("upload.php"); ?> <form action="<?= htmlspecialchars($_SERVER["PHP_SELF"]) ?>" method="post"> <h3>Envie a sua bizarrice!</h3> <fieldset> <input placeholder="Nome" type="text" name="name" value="<?= $name ?>"> <span><?= $name_error ?></span> </fieldset> <fieldset> <input placeholder="Email" type="text" name="email" value="<?= $email ?>"> <span><?= $email_error ?></span> </fieldset> <fieldset> <input placeholder="Site" type="text" name="url" value="<?= $url ?>"> <span><?= $url_error ?></span> </fieldset> <fieldset> <textarea value="<?= $message ?>" name="message"> </textarea> </fieldset> <fieldset> <button name="submit" type="submit" data-submit="Um instantinho...">Enviar</button> </fieldset> <div><?= $success ?></div> <?php //upload.php $name_error = $email_error = $url_error = ""; $name = $email = $message = $url = $success = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["name"])) { $name_error = "Name is required"; } else { $name = test_input($_POST["name"]); if (!preg_match("/^[a-zA-Z ]*$/",$name)) { $name_error = "Apenas letras e espaços e branco"; } } if (empty($_POST["email"])) { $email_error = "Email is required"; } else { $email = test_input($_POST["email"]); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $email_error = "Invalid email format"; } } if (empty($_POST["url"])) { $url_error = ""; } else { $url = test_input($_POST["url"]); if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$url)) { $url_error = "Invalid URL"; } } if (empty($_POST["message"])) { $message = ""; } else { $message = test_input($_POST["message"]); } if ($name_error == '' and $email_error == '' and $phone_error == '' and $url_error == '' ){ $message_body = ''; unset($_POST['submit']); foreach ($_POST as $key => $value){ $message_body .= "$key: $value\n"; } $headers = 'From: ****' . "\r\n" . 'Reply-To: 8*****' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $to = $email; $subject = 'Recebemos...'; if (mail($to, $subject, $message)){ $success = "Enviado para o multiverso..."; $name = $email = $message = $url = ''; } } } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; -
PHP Formulario para upload com nome e verificação de e-mail
Lerub respondeu ao tópico de Lerub em Web e banco de dados
Entendi sim, coléga. O que eu quis dizer é que o meu tempo anda apertado mesmo. Eu ainda dependo do AdSense para ganhar uma grana e o meu publico é bem especifico. O tipo que gosta de textão. É o que tem mais views no blog/. -
PHP Formulario para upload com nome e verificação de e-mail
Lerub respondeu ao tópico de Lerub em Web e banco de dados
Obrogado pelo conselho. E eu estou fazendo isso. O problema é quela fase de aprendizado - CTRL-C CTRL-V - e eu preciso trabalhar en tempo integral, se quiser ganhar alguma grana com o blog. Eu só consegui que check se tem um arquivo selecionado. agora, enviar e-mail de confirmação imagens para um diretório. E seria bom saber quem enviou a imagem. <doctype html> <html> <head> <title>Tests</title><meta charset="utl8"> </head> <body> <?php if($_POST && isset($_FILES['my_file'])) { $from_email = '...'; //from mail, it is mandatory with some hosts $recipient_email = '...'; //recipient email (most cases it is your personal email) //Capture POST data from HTML form and Sanitize them, $sender_name = filter_var($_POST["sender_name"], FILTER_SANITIZE_STRING); //sender name $reply_to_email = filter_var($_POST["sender_email"], FILTER_SANITIZE_STRING); //sender email used in "reply-to" header $subject = filter_var($_POST["subject"], FILTER_SANITIZE_STRING); //get subject from HTML form $message = filter_var($_POST["message"], FILTER_SANITIZE_STRING); //message /* //don't forget to validate empty fields if(strlen($sender_name)<1){ die('Name is too short or empty!'); } */ //Get uploaded file data $file_tmp_name = $_FILES['my_file']['tmp_name']; $file_name = $_FILES['my_file']['name']; $file_size = $_FILES['my_file']['size']; $file_type = $_FILES['my_file']['type']; $file_error = $_FILES['my_file']['error']; if($file_error > 0) { die('Upload error or No files uploaded'); } //read from the uploaded file & base64_encode content for the mail $handle = fopen($file_tmp_name, "r"); $content = fread($handle, $file_size); fclose($handle); $encoded_content = chunk_split(base64_encode($content)); $boundary = md5("sanwebe"); //header $headers = "MIME-Version: 1.0\r\n"; $headers .= "From:".$from_email."\r\n"; $headers .= "Reply-To: ".$reply_to_email."" . "\r\n"; $headers .= "Content-Type: multipart/mixed; boundary = $boundary\r\n\r\n"; //plain text $body = "--$boundary\r\n"; $body .= "Content-Type: text/plain; charset=ISO-8859-1\r\n"; $body .= "Content-Transfer-Encoding: base64\r\n\r\n"; $body .= chunk_split(base64_encode($message)); //attachment $body .= "--$boundary\r\n"; $body .="Content-Type: $file_type; name=".$file_name."\r\n"; $body .="Content-Disposition: attachment; filename=".$file_name."\r\n"; $body .="Content-Transfer-Encoding: base64\r\n"; $body .="X-Attachment-Id: ".rand(1000,99999)."\r\n\r\n"; $body .= $encoded_content; $sentMail = @mail($recipient_email, $subject, $body, $headers); if($sentMail) //output success or failure messages { die('Thank you for your email'); }else{ die('Could not send mail! Please check your PHP mail configuration.'); } } ?> <form enctype="multipart/form-data" method="POST" action=""> <label>Your Name <input type="text" name="sender_name" /> </label> <label>Your Email <input type="email" name="sender_email" /> </label> <label>Subject <input type="text" name="subject" /> </label> <label>Message <textarea name="message"></textarea> </label> <label>Attachment <input type="file" name="my_file" /></label> <label><input type="submit" name="button" value="Submit" /></label> </form> </body> </html> -
PHP Formulario para upload com nome e verificação de e-mail
Lerub respondeu ao tópico de Lerub em Web e banco de dados
Isso eu já estou tentando resolver. Mas, eu ainda preciso das informações de quem enviou. Assim eu posso fazer uma referenccia a(o) visitante que enviou a imagem. Jajá eu volto com o código. Edit: Eentão... tem esse código, que eu postei aqui antes. <doctype html> <html> <head> <title>Tests</title><meta charset="utl8"> </head> <body> <?php if(isset($_POST['submit'])) { //The form has been submitted, prep a nice thank you message $output = '<h1>Thanks for your file and message!</h1>'; //Set the form flag to no display (cheap way!) $flags = 'style="display:none;"'; //Deal with the email $to = '[email protected]'; $subject = 'a file for you'; $message = strip_tags($_POST['message']); $attachment = chunk_split(base64_encode(file_get_contents($_FILES['file']['tmp_name']))); $filename = $_FILES['file']['name']; $boundary =md5(date('r', time())); $headers = "From: [email protected]\r\nReply-To: [email protected]"; $headers .= "\r\nMIME-Version: 1.0\r\nContent-Type: multipart/mixed; boundary=\"_1_$boundary\""; $message="This is a multi-part message in MIME format. --_1_$boundary Content-Type: multipart/alternative; boundary=\"_2_$boundary\" --_2_$boundary Content-Type: text/plain; charset=\"iso-8859-1\" Content-Transfer-Encoding: 7bit $message --_2_$boundary-- --_1_$boundary Content-Type: application/octet-stream; name=\"$filename\" Content-Transfer-Encoding: base64 Content-Disposition: attachment $attachment --_1_$boundary--"; mail($to, $subject, $message, $headers); } ?> <?php echo $output; ?> <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" <?php echo $flags;?>> <p><label for="message">Message</label> <textarea name="message" id="message" cols="20" rows="8"></textarea></p> <p><label for="file">File</label> <input type="file" name="file" id="file"></p> <p><input type="submit" name="submit" id="submit" value="send"></p> </form> </body> </html> Só que, mesmo sem completar nenhum campo, aparece a mensagem de agradecimento e retorna um erro. E esse é o unico código que eu testei, que não redireciona para outra página. Resultado: -
PHP Formulario para upload com nome e verificação de e-mail
Lerub respondeu ao tópico de Lerub em Web e banco de dados
Eu usei o termo errado. Eu quis dizer: CHECAR. É para que quem visita o meu blog possa enviar imagens referente a uma seção que eu penso em inaugurar. E seria legal se a pessoa pudesse deixar o seu nome e/ou nick. O e-mail é para avisar que a imagem foi publicada. -
PHP Formulario para upload com nome e verificação de e-mail
Lerub respondeu ao tópico de Lerub em Web e banco de dados
Como eu faço para validar o Upload também? E enviar os dados para um arquivo de texto? Eu consegui um meio de não ter que atualizar a página. Verei como implementar a validação do formuláril e-mail. <?php if(isset($_POST['submit'])) { //The form has been submitted, prep a nice thank you message $output = '<h1>Thanks for your file and message!</h1>'; //Set the form flag to no display (cheap way!) $flags = 'style="display:none;"'; //Deal with the email $to = '[email protected]'; $subject = 'a file for you'; $message = strip_tags($_POST['message']); $attachment = chunk_split(base64_encode(file_get_contents($_FILES['file']['tmp_name']))); $filename = $_FILES['file']['name']; $boundary =md5(date('r', time())); $headers = "From: [email protected]\r\nReply-To: [email protected]"; $headers .= "\r\nMIME-Version: 1.0\r\nContent-Type: multipart/mixed; boundary=\"_1_$boundary\""; $message="This is a multi-part message in MIME format. --_1_$boundary Content-Type: multipart/alternative; boundary=\"_2_$boundary\" --_2_$boundary Content-Type: text/plain; charset=\"iso-8859-1\" Content-Transfer-Encoding: 7bit $message --_2_$boundary-- --_1_$boundary Content-Type: application/octet-stream; name=\"$filename\" Content-Transfer-Encoding: base64 Content-Disposition: attachment $attachment --_1_$boundary--"; mail($to, $subject, $message, $headers); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>MailFile</title> </head> <body> <?php echo $output; ?> <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" <?php echo $flags;?>> <p><label for="message">Message</label> <textarea name="message" id="message" cols="20" rows="8"></textarea></p> <p><label for="file">File</label> <input type="file" name="file" id="file"></p> <p><input type="submit" name="submit" id="submit" value="send"></p> </form> </body> </html> -
PHP Formulario para upload com nome e verificação de e-mail
Lerub respondeu ao tópico de Lerub em Web e banco de dados
eu desisto! Preciso terminar um post mega atrasado. Alguma ideia para checar todos os campos? -
PHP Formulario para upload com nome e verificação de e-mail
Lerub respondeu ao tópico de Lerub em Web e banco de dados
Como eu impéço o redirecionamento para "uploads.php" e consigo fazer os dois codigos PHP funcionarem juntos? Eu estou tendo problemas com isso. -
PHP Formulario para upload com nome e verificação de e-mail
Lerub respondeu ao tópico de Lerub em Web e banco de dados
Eu resolvi voltar a usar esse código: <?php $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $uploadOk = 1; $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION); // Check if image file is a actual image or fake image if(isset($_POST["submit"])) { $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]); if($check !== false) { echo "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { echo "File is not an image."; $uploadOk = 0; } } // Check if file already exists if (file_exists($target_file)) { echo "Sorry, file already exists."; $uploadOk = 0; } // Check file size if ($_FILES["fileToUpload"]["size"] > 10000000) { echo "Sorry, your file is too large."; $uploadOk = 0; } // Allow certain file formats if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "apng" && $imageFileType != "gif" ) { echo "Sorry, only JPG, JPEG, PNG, APNG and GIF files are allowed."; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { echo "Sorry, your file was not uploaded."; // if everything is ok, try to upload file } else { if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded."; } else { echo "Sorry, there was an error uploading your file."; } } // define variables and set to empty values $nameErr = $emailErr = $genderErr = $websiteErr = ""; $name = $email = $gender = $comment = $website = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["name"])) { $nameErr = "Name is required"; } else { $name = test_input($_POST["name"]); // check if name only contains letters and whitespace if (!preg_match("/^[a-zA-Z ]*$/",$name)) { $nameErr = "Only letters and white space allowed"; } } if (empty($_POST["email"])) { $emailErr = "Email is required"; } else { $email = test_input($_POST["email"]); // check if e-mail address is well-formed if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $emailErr = "Invalid email format"; } } if (empty($_POST["website"])) { $website = ""; } else { $website = test_input($_POST["website"]); // check if URL address syntax is valid (this regular expression also allows dashes in the URL) if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$website)) { $websiteErr = "Invalid URL"; } } if (empty($_POST["comment"])) { $comment = ""; } else { $comment = test_input($_POST["comment"]); } if (empty($_POST["gender"])) { $genderErr = "Gender is required"; } else { $gender = test_input($_POST["gender"]); } } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?> O unico problema é o fato da página ser redirecionada sem a confirmação dos dados. -
PHP Formulario para upload com nome e verificação de e-mail
Lerub respondeu ao tópico de Lerub em Web e banco de dados
Até o momento, eu cheguei nesse resultado. Form: <p><span class="error">* required field.</span></p> <form action="upload.php <?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post" enctype="multipart/form-data"> Select image to upload: <input type="file" name="fileToUpload" id="fileToUpload"> <input type="submit" value="Upload Image" name="submit"> Name: <input type="text" name="name" value="<?php echo $name;?>"> <span class="error">* <?php echo $nameErr;?></span> <br><br> E-mail: <input type="text" name="email" value="<?php echo $email;?>"> <span class="error">* <?php echo $emailErr;?></span> <br><br> Website: <input type="text" name="website" value="<?php echo $website;?>"> <span class="error"><?php echo $websiteErr;?></span> <br><br> Comment: <textarea name="comment" rows="5" cols="40"><?php echo $comment;?></textarea> <br><br> Gender: <input type="radio" name="gender" <?php if (isset($gender) && $gender=="female") echo "checked";?> value="female">Female <input type="radio" name="gender" <?php if (isset($gender) && $gender=="male") echo "checked";?> value="male">Male <span class="error">* <?php echo $genderErr;?></span> <br><br> </form> PHP: <?php $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $uploadOk = 1; $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION); // Check if image file is a actual image or fake image if(isset($_POST["submit"])) { $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]); if($check !== false) { echo "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { echo "File is not an image."; $uploadOk = 0; } } // Check if file already exists if (file_exists($target_file)) { echo "Sorry, file already exists."; $uploadOk = 0; } // Check file size if ($_FILES["fileToUpload"]["size"] > 10000000) { echo "Sorry, your file is too large."; $uploadOk = 0; } // Allow certain file formats if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "apng" && $imageFileType != "gif" ) { echo "Sorry, only JPG, JPEG, PNG, APNG and GIF files are allowed."; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { echo "Sorry, your file was not uploaded."; // if everything is ok, try to upload file } else { if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded."; } else { echo "Sorry, there was an error uploading your file."; } } // define variables and set to empty values $nameErr = $emailErr = $genderErr = $websiteErr = ""; $name = $email = $gender = $comment = $website = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["name"])) { $nameErr = "Name is required"; } else { $name = test_input($_POST["name"]); // check if name only contains letters and whitespace if (!preg_match("/^[a-zA-Z ]*$/",$name)) { $nameErr = "Only letters and white space allowed"; } } if (empty($_POST["email"])) { $emailErr = "Email is required"; } else { $email = test_input($_POST["email"]); // check if e-mail address is well-formed if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $emailErr = "Invalid email format"; } } if (empty($_POST["website"])) { $website = ""; } else { $website = test_input($_POST["website"]); // check if URL address syntax is valid (this regular expression also allows dashes in the URL) if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$website)) { $websiteErr = "Invalid URL"; } } if (empty($_POST["comment"])) { $comment = ""; } else { $comment = test_input($_POST["comment"]); } if (empty($_POST["gender"])) { $genderErr = "Gender is required"; } else { $gender = test_input($_POST["gender"]); } } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?> Só que agora, o upload não é concluido e é gerado uma mensagem de erro 404 . Edit Eu consegui uma maneira de comtornar o erro. Eu apago <?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?> que é a medida de segurança, para que não possam injetar código pela URL. E ainda da para efetuar o upload sem preencher os campos obrigatórios. Esse tutorial ensinou uma coisa interessante - e que eu aprendi com o WP - mas, ainda não consigo mesclar isso com outro tipo de formulario. Edit2 Segui esse tutorial e gera a seguinte mensagem: PHP: <?php echo '<pre>'; var_export($_POST); echo '</pre>'; echo '<pre>'; var_export($_FILES); echo '</pre>'; $error = ''; if ($_FILES['filePhoto']['error'] > 0) { $error = 'Sorry, there was an error in uploading the file'; } elseif ($_FILES['filePhoto']['type'] != 'image/gif', 'image/png', 'image/jpeg') { $error = 'Only .gif files are allowed'; } elseif ($_FILES['filePhoto']['size'] > 11000000) { $error = 'Files size should be less than 50KB'; } else { $sizeInfo = getimagesize($_FILES['filePhoto']['tmp_name']); if ($sizeInfo[0] > 100 || $sizeInfo[1] > 125) { $error = 'Desculpe! Você ultrapasspu o limite de 11M'; } else { move_uploaded_file($_FILES['filePhoto']['tmp_name'], "uploads/".$_POST['txtUsername'].".gif"); } } if ($error == '') { echo 'Thnkk yooouuu!'; } else { echo $error; } ?> Sugestões? -
PHP Formulario para upload com nome e verificação de e-mail
Lerub respondeu ao tópico de Lerub em Web e banco de dados
Ok. Eu vou dar uma olhada nisso. Eu parei com PHP, por um tempo, até migrar para WordPress. Eu vou estudar mais sobre isso. -
PHP Formulario para upload com nome e verificação de e-mail
Lerub respondeu ao tópico de Lerub em Web e banco de dados
Só verificar se é um e-mail válido. Apesar que eu não pretendo enviar uma notificação, por enquanto. É só um registro de quem enviou a imagem. agora que eu cochilei um pouco, eu vou ver como resolver isso. Eu adimito ter copiado isso da W3C. Hehe! E eu nunca consegui fazer Ajax funcuinar. já consegui até um "Hello" em PythonWeb... -
PHP Formulario para upload com nome e verificação de e-mail
Lerub postou um tópico em Web e banco de dados
Olá. Eu sou meio "iniciante" - eu já "brinquei" com PHP há anos atrás - em PHP. e pretendo criar um formulario para upload, com verificação de e-mail. E seria bom se as mensagens de aviso aparecessem na mesma página. Se isso não for possível, eu corrijo com o codigo do Wordpress. E eu já aviso que sou um pouco "orgulhoso" - se essa é a expressão corréta - então, APENAS ME DIGAM AS ALTERAÇÕES QUE EU DEVO FAZER! Formulario: <form action="upload.php" method="post" enctype="multipart/form-data"> Select image to upload: <input type="file" name="fileToUpload" id="fileToUpload"> <input type="submit" value="Upload Image" name="submit"> </form> PHP: <?php $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $uploadOk = 1; $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION); // Check if image file is a actual image or fake image if(isset($_POST["submit"])) { $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]); if($check !== false) { echo "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { echo "File is not an image."; $uploadOk = 0; } } // Check if file already exists if (file_exists($target_file)) { echo "Sorry, file already exists."; $uploadOk = 0; } // Check file size if ($_FILES["fileToUpload"]["size"] > 10000000) { echo "Sorry, your file is too large."; $uploadOk = 0; } // Allow certain file formats if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "apng" && $imageFileType != "gif" ) { echo "Sorry, only JPG, JPEG, PNG, APNG and GIF files are allowed."; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { echo "Sorry, your file was not uploaded."; // if everything is ok, try to upload file } else { if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded."; } else { echo "Sorry, there was an error uploading your file."; } } ?> -
Desculpe. Eu fiquei devendo explicações. Tive um probleminha com o cache. Tive até que reiniciar o modem - que não tem nenhuma relação com o conteudo hospedado. Tópico "solved".
-
não precisa mais...
-
Então, galéra. Sou novo nessa área de registro de dominios. Registrei o meu, os CNAMES do blogspot foram adicionado e hoje, quando os deletei, para usar o WordPress, sem o "WWW", cai na pagina de erro do Google e com, o navegador reconhece como inexistente. Os subdominios funcionam bem. Como eu resolvo isso: O SUPORTE TA OFF-LINE!
-
Há meses que eu tento programar com as libs nCurses, mas eu não estou me dando muito bem com isso. O código que eu tentei compilar, dessa vez, é esse: #include <stdlib.h> #include <curses.h> #include <signal.h> static void finish(int sig); int main(int argc, char *argv[]) { int num = 0; (void) signal(SIGINT, finish); (void) initscr(); keypad(stdscr, TRUE); (void) nonl(); (void) cbreak(); (void) echo(); if (has_colors()) { start_color(); init_pair(1, COLOR_RED, COLOR_BLACK); init_pair(2, COLOR_GREEN, COLOR_BLACK); init_pair(3, COLOR_YELLOW, COLOR_BLACK); init_pair(4, COLOR_BLUE, COLOR_BLACK); init_pair(5, COLOR_CYAN, COLOR_BLACK); init_pair(6, COLOR_MAGENTA, COLOR_BLACK); init_pair(7, COLOR_WHITE, COLOR_BLACK); } for (;;) { int c = getch(); attrset(COLOR_PAIR(num % 8)); num++; } finish(0); } static void finish(int sig) { endwin(); exit(0); } Desse tutorial: Para compilar: gcc -lncurses Saida do comando: Eu já tentei até retirar os parenteses dos "void" e nada. Eu baixei as lib "libcurses", "libncurses" e todas as outras pelo "apt-get".
-
Sei. De qualquer forma, eu gosto de saber como isso funciona. E outra, ja ouv falar em falhas. Não lembro se no JQuery ou AJAX. E pela entonação, parecem ser sérias. Tenho receio de prejudicar a segurança. Edit: Fazem 30 min e ninguém respondeu... Como eu resolvo isso?
-
Confesso que eu tenho um certo preconceito, quanto essas linuagens. Devido o uso desnecessário, da galéra, para fazer coisas que podem sem feitas com CSS. Enfim... vou ver como eu resolvo isso.
-
Não curto muito.
-
Eu resolvi adicionar essa modo em meu blog. Só que há um erro, ao acessar a postagem. Na página inicial, aparece normal. Eis o código: <a class='night' href='#' onclick='nightMode()'>"emojilua"</a> <a class='night' href='#' onclick='dayMode()'>"emojisol"</a> <script> function nightMode() { document.getElementsByTagName("BODY")[0].style.background = "black"; document.getElementsByTagName("BODY")[0].style.color = "white"; document.getElementsByClassName("post")[0].style.backgroundColor = "#363636"; document.getElementsByTagName("P")[0].style.color = "white"; document.getElementsByClassName("post")[1].style.backgroundColor = "#363636"; document.getElementsByTagName("P")[1].style.color = "white"; document.getElementsByClassName("post")[2].style.backgroundColor = "#363636"; document.getElementsByTagName("P")[2].style.color = "white"; document.getElementsByTagName("footer")[0].style.backgroundColor = "#363636"; document.getElementsByTagName("footer")[0].style.color = "white"; document.getElementsByClassName("column-right-outer")[0].style.background = "#363636"; document.getElementsByClassName("column-right-outer")[0].style.color = "white"; document.getElementsByClassName("subtitle")[0].style.color = "gray"; } </script> O que acontece, aqui?
Sobre o Clube do Hardware
No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais
Direitos autorais
Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais