I have this problem, i have an upload and i would like to replace all spacing with no spacing, the problem is that i have used $abcd = str_replace (" ", "", $abcd); this should work but i dont know where to put it in or what parameters to use and so on, anyone got some brain storming they want to share please?

the site code, tell me if you want to see the class

if (isset($_POST['send_billed'])) {
        $type = mysql_prep($_POST['type']);
        $pris = mysql_prep($_POST['pris']);
        $dato_str = mysql_prep($_POST['dato']);
        $navn = mysql_prep($_POST['navn']);

        if (empty ($pris))         $error[] = "Du skal udfylde pris.";
        if (empty ($dato_str))     $error[] = "Du skal udfylde dato.";
        if (empty ($navn))         $error[] = "Du skal udfylde navn.";

$dato_array = explode('/',$dato_str);
$dato = mktime(0,0,0,$dato_array[1], $dato_array[0], $dato_array[2]);
if ($_FILES['file']['error']==0){                           
$mitBillede = new billede("img/postkort/");
$nytBillede = $mitBillede->upload();

if($nytBillede != ""){

$sql_opretbilled = "insert into galleri (type_id, pris, dato, navn, img_src)
values('$type','$pris','$dato','$navn','$nytBillede')";                 mysql_query($sql_opretbilled) or die(mysql_error());
$finished = "finished";                             redirect_to("admin.php?side=3&&msg=$finished");

Recommended Answers

All 2 Replies

Well looks like your passing the whole $_FILES array to the billede class in class.billede.php. so your changes would most likely need to be in there. But with out seeing it, cant say where in that file.


IN your code look FOR 'move_uploaded_file' function, you might have set the target path , i.e. the folder you want to upload the Image, use the code shown below

$target_path = $target_path_base . str_replace(' ','', $_FILES);
move_uploaded_file($_FILES, $target_path)


Best KP'S

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.