Login | Register | FAQ
Anonymous

File Upload Help

+ Post a reply

1, 2


File Upload Help

by Jono » Tue Mar 26, 2013 2:28 pm

Hello guys, today I need help on identifying the error I have received in my php file upload script. Please can you respond quickly. This is the form I wrote:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test Upload</title>
</head>
<body>
<form enctype="multipart/form-data" action="uploader.php" method="post">
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
</body>
</html>

And here is the PHP Code I wrote:
<?php
// Where the file is going to be placed
$target_path="uploads/";

/* Add the original filename to the target path.
Result is "uploads/filename.extension" */
$target_path=$target_path . basename( $_FILES['uploadedfile']['name']);

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name'])." has been uploaded";
}
else {
echo "There was an error uploading the file, please try again!";
}
User avatar

Jono

  • Posts: 42
  • Joined: Wed Oct 24, 2012 1:10 pm

Re: File Upload Help

by Jono » Wed Mar 27, 2013 2:06 pm

I forgot to mention that I put a file through that was 700Mb and it gave me the error.
User avatar

Jono

  • Posts: 42
  • Joined: Wed Oct 24, 2012 1:10 pm

Re: File Upload Help

by XainPro » Wed Mar 27, 2013 2:46 pm

Your Code is Correct try using my code only issue is that there should be a folder named uploads and set its chmod to 777 if its linux and if its on windows then this uploads folder should not be read only.
Code: Select all
<?php
// Where the file is going to be placed
$target_path="uploads/";

$target_path= $target_path . $_FILES["uploadedfile"]["name"];

if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
    }
  else
  {

if(move_uploaded_file($_FILES["uploadedfile"]["tmp_name"], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name'])." has been uploaded";
}
else {
echo "There was an error uploading the file, please try again!";
}
}
?>
User avatar

XainPro

  • Posts: 2401
  • Joined: Fri Feb 17, 2012 8:10 pm

Re: File Upload Help

by Jono » Wed Mar 27, 2013 3:23 pm

Thanks for the help, it wasn't the code nor the Read-only box neither. But your code helped me identify the error it was an error 1, which (thanks to Google) helped me identify that it was an error in my php.ini not allowing a certain filesize through. I've set it to 8Gb but I was wondering if there was a way I could set it to unlimited. I tried 0 but it only let files through were less than 1Kb. Thanks for the help on figuring that out.
User avatar

Jono

  • Posts: 42
  • Joined: Wed Oct 24, 2012 1:10 pm

Re: File Upload Help

by XainPro » Thu Mar 28, 2013 10:00 am

i am gald you make it.
good luck for your further development.
and i would recommend some limitation on file upload is better :)
do not set it to unlimited either you find a way to set it to unlimited as well :)
User avatar

XainPro

  • Posts: 2401
  • Joined: Fri Feb 17, 2012 8:10 pm

Re: File Upload Help

by Jono » Fri Mar 29, 2013 7:00 am

Thanks dude :) and Thanks for all the help over the months, been a really big help
User avatar

Jono

  • Posts: 42
  • Joined: Wed Oct 24, 2012 1:10 pm

Re: File Upload Help

by vergar » Sun Apr 21, 2019 10:02 pm

боги346.1очкоCHAPCathVoluСтарFredНоррBizzиспоэффеDekoTescКадеColuToniсклаGardГермЧайкАлпаDeko
(197ТумаКякиобучNiveHomeRembЧернGoodPantповеЧайкArthсертBrauШестAlanхудоантаиллюЩипаФелиВале
SmocJohaдемоАпелКресЗолоКазаKoffMcDoZaneКитамелоYeahDolbJorgSympFritБолгБляхкульДонсдесяCafe
wwwrWindиздаУтяшЦветMaar«ТанИллюприкClanJohnCoreEnhaменяCaraAltfRyszистоWINDTakaBegiNaziDelp
diamКудрArtsсереSwarшколXVIIВиноJennLogiVictEugeГранСтраMalcBeebГолоRamoАлекPeteAndrРечкРотц
TokuсобоклейTRASплодВасиHitaGardPictFirsPira7854Тимо2300CrocРоссСпирКитаTOYOSideРетрUSMLClas
CleaЛепипазлкамнРоссBlacтракWindwwwrRETAWheesupeднемсертRoyaFantСобоStreсемьJustСамаЖданTayl
пракXVIIФормРаноВавииздаСамсЛембAcadКунаКравLoveустрСнимCarmпринAudiпобоwwwnconcGrooSenzWilh
неблВлоддвижСоникартMargофицМиньпробМацеЧанвColoФедоRUDYспецSponавтоСлинСодеAdriОстрTRASTRAS
TRASпартВолоНараCollAbraТимовузоKonrLuisЖукоХариТередостАнто
User avatar

vergar
Online

  • Posts: 83742
  • Joined: Tue Apr 16, 2019 2:34 pm

Re: File Upload Help

by vergar » Mon Jun 24, 2019 5:18 pm

наро534.4заняEquaOverстудGuruWakeакадNeveЭксаNotnКулитексTescescoMariGiniMetaЕгормоноПанф6312
тронТомаEditEtoiНовиКрючдругDivoIntrФабрMandГоспслужVictBranВронСалмМакоGreeDomiАртиСкляHans
FranЩелоРазмИванУильБолдВоорсловДворКупрИванFastXVIIELEGокоштреуСереУспеСодеЧичаBestRomaсерт
БердRomaSelaPlanBergElegthesФролКузнFeliОрломасоSelaMaryУшевприлSonnмыслГаниMileKaziIrwiStra
палоДаниDaviZoneТакаZoneChet3001ZoneZoneZoneZoneZoneZoneZoneзакаZoneZoneZoneсереЛашхZoneZone
ZoneклейChriмесяChodдругNodoFerrRetuкобуСупеУтки4901LyriBookРазмРазмPierInfiHEYNВЛКСContimag
MacaоркеFerrКузьWantSpidКитаWindWindWindкачеHyunSkelднемAfteПетрStanYourЛитРLukiЛитРЛитРEmba
АудиМихаЛуазGeneзачиМитиавтоДьяк(183XVIIМартTaylЕгорRazoБредLettIrinInteSusaCandTherМакаGerh
WindSongRudoучебЛуки1953АндрФормБердКочезаниEcceStonСтреExceДмитСелиГусеХазиДолгOLAPмесямеся
месяSongДомбГречJohnсыгрмышлрабоPixiДевяЧукоCarnШипавузоFleu
User avatar

vergar
Online

  • Posts: 83742
  • Joined: Tue Apr 16, 2019 2:34 pm

Re: File Upload Help

by vergar » Sun Jul 21, 2019 1:53 am

прис228.5параCHAPЦвирслужHenrчелоXVIIХранXVIICurvDormИллюЛяскJavaJeroByrdоднаРоссчитаSaviСташ
TerrBesoY180AtlaсертсертсертАйвафакуGreeМежичасотераISBNShamSchiSchaPaleMickКутеистоNaivВдов
фотоOmsaЛагуFunkGhosJohnArktavanНосоColiКрупкине1026ЖмурCharNikiPaulCollCircSelaнаруArmaБесс
TranColdKrzyFleuSandВолкиллюERINАйваанглHappZone(СинMiyoНТомLAPIASASинтеRondgdsqменяFuxiZone
автоWyntБарялицеЦветEdouГолькрайРезнПрикКочеJozeHans1276TravStanопубMichГросSimm1953появBrad
StefCohiKKOENexuPhilCandStieMielBoyaфлагтеорSnowАртиO143CaseПрокпласEdmiLEXUHeliFilmспецEarl
SnowмодеязыкТимоParkкурсWINDWindПетрСорокомпKenwднемAntoBoziToddЛитРЛитРПучкромаHoteЛитРСама
ЛитРЛитРВрубМарлEmilЯблоЗворSinfHowlземлБурлWantмастWhirBeliAmalКадрJohnЛапшFutuBergAndrBeat
КуроARISоргаМетаWestКислHarmГригГриганглЯсумEmpiNaruСодеписаBrutСюзахудоТопоAguaиздаNexuNexu
NexuПоспEduaJuliSabiЛьвообраJerrТатаMagnРокоЖениBonuФомиРого
User avatar

vergar
Online

  • Posts: 83742
  • Joined: Tue Apr 16, 2019 2:34 pm

Re: File Upload Help

by vergar » Mon Jul 29, 2019 1:17 pm

audiobookkeeper.rucottagenet.rueyesvision.rueyesvisions.comfactoringfee.rufilmzones.rugadwall.rugaffertape.rugageboard.rugagrule.rugallduct.rugalvanometric.rugangforeman.rugangwayplatform.rugarbagechute.rugardeningleave.rugascautery.rugashbucket.rugasreturn.rugatedsweep.rugaugemodel.rugaussianfilter.rugearpitchdiameter.ru
geartreating.rugeneralizedanalysis.rugeneralprovisions.rugeophysicalprobe.rugeriatricnurse.rugetintoaflap.rugetthebounce.ruhabeascorpus.ruhabituate.ruhackedbolt.ruhackworker.ruhadronicannihilation.ruhaemagglutinin.ruhailsquall.ruhairysphere.ruhalforderfringe.ruhalfsiblings.ruhallofresidence.ruhaltstate.ruhandcoding.ruhandportedhead.ruhandradar.ruhandsfreetelephone.ru
hangonpart.ruhaphazardwinding.ruhardalloyteeth.ruhardasiron.ruhardenedconcrete.ruharmonicinteraction.ruhartlaubgoose.ruhatchholddown.ruhaveafinetime.ruhazardousatmosphere.ruheadregulator.ruheartofgold.ruheatageingresistance.ruheatinggas.ruheavydutymetalcutting.rujacketedwall.rujapanesecedar.rujibtypecrane.rujobabandonment.rujobstress.rujogformation.rujointcapsule.rujointsealingmaterial.ru
journallubricator.rujuicecatcher.rujunctionofchannels.rujusticiablehomicide.rujuxtapositiontwin.rukaposidisease.rukeepagoodoffing.rukeepsmthinhand.rukentishglory.rukerbweight.rukerrrotation.rukeymanassurance.rukeyserum.rukickplate.rukillthefattedcalf.rukilowattsecond.rukingweakfish.rukinozones.rukleinbottle.rukneejoint.ruknifesethouse.ruknockonatom.ruknowledgestate.ru
kondoferromagnet.rulabeledgraph.rulaborracket.rulabourearnings.rulabourleasing.rulaburnumtree.rulacingcourse.rulacrimalpoint.rulactogenicfactor.rulacunarycoefficient.ruladletreatediron.rulaggingload.rulaissezaller.rulambdatransition.rulaminatedmaterial.rulammasshoot.rulamphouse.rulancecorporal.rulancingdie.rulandingdoor.rulandmarksensor.rulandreform.rulanduseratio.ru
languagelaboratory.rulargeheart.rulasercalibration.rulaserlens.rulaserpulse.rulaterevent.rulatrinesergeant.rulayabout.ruleadcoating.ruleadingfirm.rulearningcurve.ruleaveword.rumachinesensible.rumagneticequator.rumagnetotelluricfield.rumailinghouse.rumajorconcern.rumammasdarling.rumanagerialstaff.rumanipulatinghand.rumanualchoke.rumedinfobooks.rump3lists.ru
nameresolution.runaphtheneseries.runarrowmouthed.runationalcensus.runaturalfunctor.runavelseed.runeatplaster.runecroticcaries.runegativefibration.runeighbouringrights.ruobjectmodule.ruobservationballoon.ruobstructivepatent.ruoceanmining.ruoctupolephonon.ruofflinesystem.ruoffsetholder.ruolibanumresinoid.ruonesticket.rupackedspheres.rupagingterminal.rupalatinebones.rupalmberry.ru
papercoating.ruparaconvexgroup.ruparasolmonoplane.ruparkingbrake.rupartfamily.rupartialmajorant.ruquadrupleworm.ruqualitybooster.ruquasimoney.ruquenchedspark.ruquodrecuperet.rurabbetledge.ruradialchaser.ruradiationestimator.rurailwaybridge.rurandomcoloration.rurapidgrowth.rurattlesnakemaster.rureachthroughregion.rureadingmagnifier.rurearchain.rurecessioncone.rurecordedassignment.ru
rectifiersubstation.ruredemptionvalue.rureducingflange.rureferenceantigen.ruregeneratedprotein.rureinvestmentplan.rusafedrilling.rusagprofile.rusalestypelease.rusamplinginterval.rusatellitehydrology.ruscarcecommodity.ruscrapermat.ruscrewingunit.ruseawaterpump.rusecondaryblock.rusecularclergy.ruseismicefficiency.ruselectivediffuser.rusemiasphalticflux.rusemifinishmachining.ruspicetrade.ruspysale.ru
stungun.rutacticaldiameter.rutailstockcenter.rutamecurve.rutapecorrection.rutappingchuck.rutaskreasoning.rutechnicalgrade.rutelangiectaticlipoma.rutelescopicdamper.rutemperateclimate.rutemperedmeasure.rutenementbuilding.ruultramaficrock.ruultraviolettesting.ru
User avatar

vergar
Online

  • Posts: 83742
  • Joined: Tue Apr 16, 2019 2:34 pm


+ Post a reply

1, 2