javascript - Jquery and Swfupload causing whole website to slow down drastically -
i have been working on website while , encountered problem can't seem figure out. relatively new web developer appreciated.
i using swfupload handle audio uploads website. aware swfupload has power handle multiple file uploads @ once through queue. however, when queue long list of audio files, uploading begin slow , slower each file...the php code used handle uploading given below. though code references lot of other helper functions, best explain trying do...
essentially fluff aside such user authorization checks..etc, code creates temporary "track" stored in database. tracks stored under album(i refer albums releases) , once temporary track created under album, can upload audio file under database entry. use getid3 parse media file , update track information in database whatever can pull audio.
this code works fine if select on (queue up) 15ish tracks upload, tracks after 15th 1 becomes slow , 50th track...uploading take on 10 minutes 1 file. know there can lot of issues causing wondering if had hint on issue might be?
thanks lot!
<?php private function savebatchaudio($artist) { utils::checkfileupload(); if ($this->iseditable($artist['artist_id'])) { require_once "db/dbtracks.php"; require_once "db/dbreleases.php"; $tracklist = dbtracks::gettracksbyreleasehash($_post['releasehash'], 0, 100); $tracklistorder = count($tracklist); $row = array( 'track_name' => utils::escape($_post['name']), 'artist_id' => $artist['artist_id'], 'release_hash' => utils::escape($_post['releasehash']), 'track_order' => $tracklistorder+1, 'user_id' => $_session['user']['user_id'], 'track_upload_user_ip' => utils::getipaddress() ); $id = dbtracks::newtrack($row); $this->log($artist, "user [{$_session['user']['user_name']}] has created track:" . var_export($row, true)); } else { echo json_encode(array( 'message' => utils::getmessage('e001') )); } require_once "db/dbtracks.php"; $track = dbtracks::gettrackbyid($id); if (!empty($track)) { $f = __ffm_archive__ . $track['release_hash'] . '/' . $track['track_filename']; if (!empty($track['track_filename']) && file_exists($f)) { unlink($f); } include_once "formatting.php"; $filename = wp_unique_filename(__ffm_archive__ . $track['release_hash'], $_files['filedata']['name']); $path = __ffm_archive__ . $track['release_hash'] . '/' . $filename; if (!is_dir(dirname($path))) { wp_mkdir_p(dirname($path)); } move_uploaded_file($_files["filedata"]["tmp_name"], $path); require_once(dirname(__file__) . '/../../getid3/getid3.php'); $getid3 = new getid3; $getid3->setoption(array('encoding' => 'utf-8')); $info = $getid3->analyze($path); getid3_lib::copytagstocomments($info); $data = array( 'track_name' => isset($info['tags']['id3v2']['title']['0']) ? $info['tags']['id3v2']['title']['0'] : $filename, 'track_label' => isset($info['tags']['id3v2']['album']['0']) ? $info['tags']['id3v2']['album']['0'] : utils::escape($_post['label']), 'track_year' => isset($info['tags']['id3v2']['year']['0']) ? $info['tags']['id3v2']['year']['0'] : utils::escape($_post['year']), 'track_filename' => $filename, 'track_size' => filesize($path), 'track_length' => isset($info['playtime_seconds']) ? $info['playtime_seconds'] : 0, 'track_bitrate' => isset($info['audio']['bitrate']) ? $info['audio']['bitrate'] : 0, ); dbtracks::updatetrackbyid($track['track_id'], $data); $this->zipfolder(__ffm_archive__ . $track['release_hash'], $track['release_hash']); $this->log($artist, "user [{$_session['user']['user_name']}] has uploaded track"); echo json_encode(array( 'mp3' => $mp3 = __ffm_archive_front__ . $track['release_hash'] . '/' . $filename )); } else { echo json_encode(array( 'message' => utils::getmessage('e002') )); } }
?>
Comments
Post a Comment